Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

l2tp: device MTU setup, tunnel socket needs a lock

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>

authored by

R. Parameswaran and committed by
David S. Miller
57240d00 4a6e3c5d

+4 -2
+1 -1
include/linux/net.h
··· 298 298 int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 299 299 int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how); 300 300 301 - /* Following routine returns the IP overhead imposed by a socket. */ 301 + /* Routine returns the IP overhead imposed by a (caller-protected) socket. */ 302 302 u32 kernel_sock_ip_overhead(struct sock *sk); 303 303 304 304 #define MODULE_ALIAS_NETPROTO(proto) \
+2
net/l2tp/l2tp_eth.c
··· 225 225 dev->needed_headroom += session->hdr_len; 226 226 return; 227 227 } 228 + lock_sock(tunnel->sock); 228 229 l3_overhead = kernel_sock_ip_overhead(tunnel->sock); 230 + release_sock(tunnel->sock); 229 231 if (l3_overhead == 0) { 230 232 /* L3 Overhead couldn't be identified, this could be 231 233 * because tunnel->sock was NULL or the socket's
+1 -1
net/socket.c
··· 3360 3360 /* This routine returns the IP overhead imposed by a socket i.e. 3361 3361 * the length of the underlying IP header, depending on whether 3362 3362 * this is an IPv4 or IPv6 socket and the length from IP options turned 3363 - * on at the socket. 3363 + * on at the socket. Assumes that the caller has a lock on the socket. 3364 3364 */ 3365 3365 u32 kernel_sock_ip_overhead(struct sock *sk) 3366 3366 {