summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorR. Parameswaran <parameswaran.r7@gmail.com>2017-04-12 18:31:04 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 16:40:33 +0200
commit403a7a561a0347368d84b53b03fc03c2d23b8861 (patch)
treef5e77579cc73002fd4d7d3089f70376131cf971e /net
parentee1f28d8601e3ce14a209b3703cc0d567a9f5e25 (diff)
l2tp: device MTU setup, tunnel socket needs a lock
commit 57240d007816486131bee88cd474c2a71f0fe224 upstream. The MTU overhead calculation in L2TP device set-up merged via commit b784e7ebfce8cfb16c6f95e14e8532d0768ab7ff needs to be adjusted to lock the tunnel socket while referencing the sub-data structures to derive the socket's IP overhead. Reported-by: Guillaume Nault <g.nault@alphalink.fr> Tested-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: R. Parameswaran <rparames@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net> Cc: Giuliano Procida <gprocida@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/l2tp/l2tp_eth.c2
-rw-r--r--net/socket.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index facc180d1635..e0a65ee1e830 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -240,7 +240,9 @@ static void l2tp_eth_adjust_mtu(struct l2tp_tunnel *tunnel,
dev->needed_headroom += session->hdr_len;
return;
}
+ lock_sock(tunnel->sock);
l3_overhead = kernel_sock_ip_overhead(tunnel->sock);
+ release_sock(tunnel->sock);
if (l3_overhead == 0) {
/* L3 Overhead couldn't be identified, this could be
* because tunnel->sock was NULL or the socket's
diff --git a/net/socket.c b/net/socket.c
index 1a2a7320554b..88086d18c208 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -3308,7 +3308,7 @@ EXPORT_SYMBOL(kernel_sock_shutdown);
/* This routine returns the IP overhead imposed by a socket i.e.
* the length of the underlying IP header, depending on whether
* this is an IPv4 or IPv6 socket and the length from IP options turned
- * on at the socket.
+ * on at the socket. Assumes that the caller has a lock on the socket.
*/
u32 kernel_sock_ip_overhead(struct sock *sk)
{