Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1621763 > unrolled thread

[PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

Started by"R. Parameswaran" <parameswaran.r7@gmail.com>
First post2017-04-12 05:20 +0200
Last post2017-04-12 22:40 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs  a lock "R. Parameswaran" <parameswaran.r7@gmail.com> - 2017-04-12 05:20 +0200
    Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket  needs a lock Guillaume Nault <g.nault@alphalink.fr> - 2017-04-12 10:00 +0200
      Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket  needs a lock R Parameswaran <parameswaran.r7@gmail.com> - 2017-04-12 22:50 +0200
    Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket  needs a lock David Miller <davem@davemloft.net> - 2017-04-12 16:20 +0200
      Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket  needs a lock R Parameswaran <parameswaran.r7@gmail.com> - 2017-04-12 22:40 +0200

#1621763 — [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

From"R. Parameswaran" <parameswaran.r7@gmail.com>
Date2017-04-12 05:20 +0200
Subject[PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock
Message-ID<tvgZ3-7E0-1@gated-at.bofh.it>
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.
---
 include/linux/net.h | 2 +-
 net/l2tp/l2tp_eth.c | 2 ++
 net/socket.c        | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index a42fab2..abcfa46 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -298,7 +298,7 @@ int kernel_sendpage(struct socket *sock, struct page *page, int offset,
 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) \
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 138566a..b722d55 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -225,7 +225,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 eea9970..c2564eb 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -3360,7 +3360,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)
 {
-- 
2.1.4

[toc] | [next] | [standalone]


#1621898 — Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

FromGuillaume Nault <g.nault@alphalink.fr>
Date2017-04-12 10:00 +0200
SubjectRe: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock
Message-ID<tvlm2-1MB-17@gated-at.bofh.it>
In reply to#1621763
On Tue, Apr 11, 2017 at 08:14:37PM -0700, R. Parameswaran wrote:
> 
> 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.

Thanks.

Tested-by: Guillaume Nault <g.nault@alphalink.fr>

BTW, you don't need to add "v1" for the first version of a patch.
There's also no need for numbering pathes when there's only one in the
series. And we normally prefix the commit message with "<subsystem>: ".
For this patch, your subject would look like " [PATCH net-next] l2tp: ...".

Also, you could have added a "Reported-by:" tag (I don't really mind
in this case, but that's good practice).

[toc] | [prev] | [next] | [standalone]


#1622547 — Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

FromR Parameswaran <parameswaran.r7@gmail.com>
Date2017-04-12 22:50 +0200
SubjectRe: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock
Message-ID<tvxnb-Zv-19@gated-at.bofh.it>
In reply to#1621898
Hi Guillaume,

Please see inline:

On Wed, Apr 12, 2017 at 12:53 AM, Guillaume Nault <g.nault@alphalink.fr> wrote:
> On Tue, Apr 11, 2017 at 08:14:37PM -0700, R. Parameswaran wrote:
>>
>> 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.
>
> Thanks.
>
> Tested-by: Guillaume Nault <g.nault@alphalink.fr>
>
> BTW, you don't need to add "v1" for the first version of a patch.
> There's also no need for numbering pathes when there's only one in the
> series. And we normally prefix the commit message with "<subsystem>: ".
> For this patch, your subject would look like " [PATCH net-next] l2tp: ...".
>
> Also, you could have added a "Reported-by:" tag (I don't really mind
> in this case, but that's good practice).

Thanks for correcting these (and for testing the changes) and sorry
for the Reported-by omission. I'll respin by tonight
with these, per reply to Dave.

regards,

Ramkumar

[toc] | [prev] | [next] | [standalone]


#1622167 — Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

FromDavid Miller <davem@davemloft.net>
Date2017-04-12 16:20 +0200
SubjectRe: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock
Message-ID<tvrhM-5ul-1@gated-at.bofh.it>
In reply to#1621763
From: "R. Parameswaran" <parameswaran.r7@gmail.com>
Date: Tue, 11 Apr 2017 20:14:37 -0700 (PDT)

> 
> 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.

This is missing a proper signoff.

The subject line also needs to be fixed "[PATCH net-next] l2tp: " as explained
by Guillaume.

Thanks.

[toc] | [prev] | [next] | [standalone]


#1622543 — Re: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock

FromR Parameswaran <parameswaran.r7@gmail.com>
Date2017-04-12 22:40 +0200
SubjectRe: [PATCH net-next v1 1/1] L2TP device MTU setup - tunnel socket needs a lock
Message-ID<tvxdw-UY-27@gated-at.bofh.it>
In reply to#1622167
Hi Dave,

Please see inline:

On Wed, Apr 12, 2017 at 7:13 AM, David Miller <davem@davemloft.net> wrote:
> From: "R. Parameswaran" <parameswaran.r7@gmail.com>
> Date: Tue, 11 Apr 2017 20:14:37 -0700 (PDT)
>
>>
>> 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.
>
> This is missing a proper signoff.
>
> The subject line also needs to be fixed "[PATCH net-next] l2tp: " as explained
> by Guillaume.
>

Thanks, I will re-spin with these corrections by tonight PT.

regards,

Ramkumar
> Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web