From: Greg Kroah-Hartman Date: Sun, 24 May 2020 09:54:09 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.4.225~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14b00aa0f54b7ee93fe8f70498238f616626d8d9;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch --- diff --git a/queue-4.9/l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch b/queue-4.9/l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch new file mode 100644 index 00000000000..6e9d496f1ee --- /dev/null +++ b/queue-4.9/l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch @@ -0,0 +1,62 @@ +From 57240d007816486131bee88cd474c2a71f0fe224 Mon Sep 17 00:00:00 2001 +From: "R. Parameswaran" +Date: Wed, 12 Apr 2017 18:31:04 -0700 +Subject: l2tp: device MTU setup, tunnel socket needs a lock + +From: R. Parameswaran + +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 +Tested-by: Guillaume Nault +Signed-off-by: R. Parameswaran +Signed-off-by: David S. Miller +Cc: Giuliano Procida +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/net.h | 2 +- + net/l2tp/l2tp_eth.c | 2 ++ + net/socket.c | 2 +- + 3 files changed, 4 insertions(+), 2 deletions(-) + +--- a/include/linux/net.h ++++ b/include/linux/net.h +@@ -298,7 +298,7 @@ int kernel_sendpage(struct socket *sock, + int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); + int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how); + +-/* Following routine returns the IP overhead imposed by a socket. */ ++/* Routine returns the IP overhead imposed by a (caller-protected) socket. */ + u32 kernel_sock_ip_overhead(struct sock *sk); + + #define MODULE_ALIAS_NETPROTO(proto) \ +--- a/net/l2tp/l2tp_eth.c ++++ b/net/l2tp/l2tp_eth.c +@@ -240,7 +240,9 @@ static void l2tp_eth_adjust_mtu(struct l + 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 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3325,7 +3325,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) + { diff --git a/queue-4.9/series b/queue-4.9/series index 1369e949e64..890d9f974e9 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -48,3 +48,4 @@ l2tp-protect-sock-pointer-of-struct-pppol2tp_session-with-rcu.patch l2tp-initialise-ppp-sessions-before-registering-them.patch alsa-pcm-fix-incorrect-hw_base-increase.patch dmaengine-tegra210-adma-fix-an-error-handling-path-in-tegra_adma_probe.patch +l2tp-device-mtu-setup-tunnel-socket-needs-a-lock.patch