Re: [PATCH v2 net-next 0/2] add ppp_generic ioctl(s) to bridge channels

2020-12-02 Thread James Chapman
> Documentation/networking/ppp_generic.rst | 9 ++ > drivers/net/ppp/ppp_generic.c| 143 ++- > include/uapi/linux/ppp-ioctl.h | 2 + > 3 files changed, 152 insertions(+), 2 deletions(-) > Reviewed-by: James Chapman

Re: [PATCH net-next 0/6] l2tp: add ac/pppoe driver

2020-10-01 Thread James Chapman
tp/l2tp_core.h | 4 +- > net/l2tp/l2tp_eth.c | 3 +- > net/l2tp/l2tp_netlink.c | 20 +- > net/l2tp/l2tp_ppp.c | 3 +- > 9 files changed, 527 insertions(+), 28 deletions(-) > create mode 100644 net/l2tp/l2tp_ac_pppoe.c > Reviewed-by: James Chapman

Re: [PATCH net-next 0/6] l2tp: miscellaneous cleanups

2020-09-03 Thread James Chapman
de in l2tp_tunnel_closeall > > net/l2tp/l2tp_core.c| 134 +++- > net/l2tp/l2tp_core.h| 10 ++- > net/l2tp/l2tp_eth.c | 2 +- > net/l2tp/l2tp_ip.c | 2 +- > net/l2tp/l2tp_ip6.c | 2 +- > net/l2tp/l2tp_netlink.c | 2 +- > net/l2tp/l2tp_ppp.c | 15 ++++- > 7 files changed, 87 insertions(+), 80 deletions(-) > Reviewed-by: James Chapman

Re: [PATCH net-next 0/9] l2tp: replace custom logging code with tracepoints

2020-08-21 Thread James Chapman
oints. > > This patchset refactors l2tp to: > > * remove excessive logging > * tweak useful log messages to use the standard pr_* calls for logging >rather than the l2tp wrappers > * replace debug-level logging with tracepoints > * add tracepoints for capturing tunnel and s

Re: [PATCH net-next] Documentation/networking: update l2tp docs

2020-08-19 Thread James Chapman
On 18/08/2020 19:57, Jakub Kicinski wrote: > On Tue, 18 Aug 2020 16:11:35 +0100 jchap...@katalix.com wrote: >> From: James Chapman >> >> Kernel documentation of L2TP has not been kept up to date and lacks >> coverage of some L2TP APIs. While addressing this, refacto

Re: [PATCH net-next 0/6] l2tp: further checkpatch.pl cleanups

2020-07-23 Thread James Chapman
+- > net/l2tp/l2tp_ip6.c | 2 +- > net/l2tp/l2tp_netlink.c | 206 ++-- > net/l2tp/l2tp_ppp.c | 59 ++++++------ > 6 files changed, 169 insertions(+), 150 deletions(-) > Reviewed-by: James Chapman

Re: [PATCH v2 net-next 00/10] l2tp: cleanup checkpatch.pl warnings

2020-07-22 Thread James Chapman
> net/l2tp/l2tp_ip.c | 17 + > net/l2tp/l2tp_ip6.c | 29 +++ > net/l2tp/l2tp_netlink.c | 75 --------- > net/l2tp/l2tp_ppp.c | 20 +- > 8 files changed, 145 insertions(+), 177 deletions(-) > Reviewed-by: James Chapman

Re: [PATCH v2 bpf 2/2] bpf: net: Avoid incorrect bpf_sk_reuseport_detach call

2020-07-09 Thread James Chapman
ned by BPF. I have reservations about using a bit in sk_user_data to indicate ownership of that pointer. But putting that aside, I confirm that the patch fixes the problem. Acked-by: James Chapman Tested-by: James Chapman Reported-by: syzbot+9f092552ba9a5efca...@syzkaller.appspotmail.com

Re: [PATCH net] l2tp: add sk_reuseport checks to l2tp_validate_socket

2020-07-08 Thread James Chapman
On Tue, Jul 07, 2020 at 11:31:28 -0700, Martin KaFai Lau wrote: > On Mon, Jul 06, 2020 at 12:45:36PM -0700, David Miller wrote: > > From: James Chapman > > Date: Mon, 6 Jul 2020 13:12:59 +0100 > > > > > The crash occurs in the socket destroy path. bpf_sk_reuseport_

Re: [PATCH net] l2tp: remove skb_dst_set() from l2tp_xmit_skb()

2020-07-08 Thread James Chapman
On Wed, Jul 08, 2020 at 04:08:09 +0800, Xin Long wrote: > On Wed, Jul 8, 2020 at 1:24 AM James Chapman wrote: > > > > On Tue, Jul 07, 2020 at 02:02:32 +0800, Xin Long wrote: > > > In the tx path of l2tp, l2tp_xmit_skb() calls skb_dst_set() to set > > > skb&#

Re: [PATCH net] l2tp: remove skb_dst_set() from l2tp_xmit_skb()

2020-07-07 Thread James Chapman
On Tue, Jul 07, 2020 at 02:02:32 +0800, Xin Long wrote: > In the tx path of l2tp, l2tp_xmit_skb() calls skb_dst_set() to set > skb's dst. However, it will eventually call inet6_csk_xmit() or > ip_queue_xmit() where skb's dst will be overwritten by: > >skb_dst_set_noref(skb, dst); > > without

bpf's usage of sk_user_data

2020-07-07 Thread James Chapman
I'm investigating a crash found by syzbot which turns out to be caused by bpf_sk_reuseport_detach assuming ownership of sk_user_data in the UDP socket destroy path and corrupts metadata of a UDP socket user (l2tp). Here's the syzbot report: https://syzkaller.appspot.com/bug?extid=9f092552ba9a5efca

[PATCH net] l2tp: add sk_reuseport checks to l2tp_validate_socket

2020-07-06 Thread James Chapman
SO_REUSEPORT were set after the socket is initialised by l2tp. 2. Should the reuseport code have a dedicated member of struct sock to use instead of sk_user_data such that SO_REUSEPORT can be used by UDP encap socket users like l2tp? Fixes: 6b9f34239b00 ("l2tp: fix races in tunnel cre

Re: L2TPv3 offset

2019-02-19 Thread James Chapman
On 19/02/2019 13:09, t.mart...@avm.de wrote: > > Hello, > > thanks for your quick response. > > "James Chapman" schrieb am 19.02.2019 13:40:10: > > > Von: "James Chapman" > > An: t.mart...@avm.de > > Kopie: da...@davemloft.net, "net

Re: L2TPv3 offset

2019-02-19 Thread James Chapman
On 19/02/2019 09:17, t.mart...@avm.de wrote: > > Hello, > > I saw that you removed the offset option from l2tp sessions in Linux > 4.16 (commit 900631ee6a2651dc4fbaecb8ef9fa5f1e3378853 l2tp: remove > configurable payload offset). Since we need something like that I'm > reaching out to you. > Adding

Re: [PATCH net] l2tp: do not accept arbitrary sockets

2018-03-06 Thread James Chapman
On 6 March 2018 at 15:54, Eric Dumazet wrote: > From: Eric Dumazet > > syzkaller found an issue caused by lack of sufficient checks > in l2tp_tunnel_create() > > RAW sockets can not be considered as UDP ones for instance. Acked-by: James Chapman

[PATCH net 2/5] l2tp: don't use inet_shutdown on ppp session destroy

2018-02-23 Thread James Chapman
patch into separate l2tp and ppp parts") Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 59f246d7b290..2d2955e8f710 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c

[PATCH net 5/5] l2tp: fix tunnel lookup use-after-free race

2018-02-23 Thread James Chapman
47bd5acde002e353...@syzkaller.appspotmail.com Reported-and-tested-by: syzbot+6e6a5ec8de31a94cd...@syzkaller.appspotmail.com Reported-and-tested-by: syzbot+9df43faf09bd400f2...@syzkaller.appspotmail.com Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 14 +++--- 1 file changed, 7 insertions(+), 7 de

[PATCH net 1/5] l2tp: don't use inet_shutdown on tunnel destroy

2018-02-23 Thread James Chapman
00 00 00 <49> 81 3c 24 80 93 3f 83 b8 00 00 00 00 44 0f 44 c0 83 fe 01 0f RIP: __lock_acquire+0x263/0x1630 RSP: 88001a37fc70 CR2: 00a0 Fixes: 309795f4bec2d ("l2tp: Add netlink control API for L2TP") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 11 ++-

[PATCH net 0/5] l2tp: fix API races discovered by syzbot

2018-02-23 Thread James Chapman
could be destroyed while its associated tunnel/session object still existed (patches 3, 4). Patch 5 addresses a problem with the way tunnels are removed from the tunnel list. Patch 5 is tagged that it addresses all four syzbot issues, though all 5 patches are needed. James Chapman (5): l2tp

[PATCH net 3/5] l2tp: fix races with tunnel socket close

2018-02-23 Thread James Chapman
02 00 00 e8 13 d6 db fc 49 8d bc 24 28 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 f a 48 c1 ea 03 <80> 3c 02 00 0f 85 ed 02 00 00 4d 8b a4 24 28 02 00 00 e8 13 16 Fixes: 80d84ef3ff1dd ("l2tp: prevent l2tp_tunnel_delete racing with userspace close") Signed-off-by: Jame

[PATCH net 4/5] l2tp: fix race in pppol2tp_release with session object destroy

2018-02-23 Thread James Chapman
20 85 64 85 e 8 2a 55 14 ff <0f> 0b 83 05 ad 2a 68 04 01 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 Fixes: ee40fb2e1eb5b ("l2tp: protect sock pointer of struct pppol2tp_session with RCU") Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c | 52 +++

[PATCH net-next v3 04/16] l2tp: refactor tunnel lifetime handling wrt its socket

2018-02-12 Thread James Chapman
no longer used so is removed. Fixes: 80d84ef3ff1dd ("l2tp: prevent l2tp_tunnel_delete racing with userspace close") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 128 ++- net/l2tp/l2tp_core.h | 26 ++- net/l2tp/l2tp_

[PATCH net-next v3 00/16] l2tp: fix API races discovered by syzbot

2018-02-12 Thread James Chapman
fixes/reported-by tags to end of commit text and add my signoff which got dropped in v2. James Chapman (16): l2tp: update sk_user_data while holding sk_callback_lock l2tp: add RCU read lock to protect tunnel ptr in ip socket destroy l2tp: don't use inet_shutdown on tunnel destroy

[PATCH net-next v3 08/16] l2tp: hide session from pppol2tp_sock_to_session if it is closing

2018-02-12 Thread James Chapman
Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index ff95a4d4eac5..947066b3d6d8 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -172,8 +172,16 @@ static

[PATCH net-next v3 01/16] l2tp: update sk_user_data while holding sk_callback_lock

2018-02-12 Thread James Chapman
orted-by: syzbot+8865eaff7f9acd593...@syzkaller.appspotmail.com Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 21 ++--- net/l2tp/l2tp_ppp.c | 8 ++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 194a7483bb93..de7

[PATCH net-next v3 06/16] l2tp: refactor session lifetime handling

2018-02-12 Thread James Chapman
inated tunnels") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 7 ++- net/l2tp/l2tp_ppp.c | 36 ++-- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 691fe9368d91..477b96cf8ab3 1

[PATCH net-next v3 05/16] l2tp: use tunnel closing flag

2018-02-12 Thread James Chapman
The tunnel's closing flag is set when the tunnel is being destroyed. Use it to reject new sessions and remove acpt_newsess which was doing the same thing. Also prevent the tunnel being seen in l2tp_tunnel_get lookups. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c

[PATCH net-next v3 02/16] l2tp: add RCU read lock to protect tunnel ptr in ip socket destroy

2018-02-12 Thread James Chapman
v3 IP encapsulation (no UDP) support") Signed-off-by: James Chapman --- net/l2tp/l2tp_ip.c | 5 - net/l2tp/l2tp_ip6.c | 5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index ff61124fdf59..42f3c2f72bf4 100644 --- a/net/l2tp/l2tp_ip.c

[PATCH net-next v3 07/16] l2tp: hide sessions if they are closing

2018-02-12 Thread James Chapman
Replace the dead flag in the session context with a closing flag and spinlock. Check it in session lookup functions such that we don't try to access session data while it is being destroyed. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 34 +- net

[PATCH net-next v3 09/16] l2tp: refactor pppol2tp_connect

2018-02-12 Thread James Chapman
It's hard to understand pppol2tp_connect so split it up into separate functions and document it better. Fixes: fd558d186d ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Signed-off-by: James Chapman --- net/l2tp/l

[PATCH net-next v3 11/16] l2tp: do session destroy using a workqueue

2018-02-12 Thread James Chapman
Handle session destroy in the same way as we handle tunnel destroy - through a workqueue. Sessions can be destroyed either because its socket is closed (if it has a socket) or by netlink request. A workqueue synchronises these. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 30

[PATCH net-next v3 03/16] l2tp: don't use inet_shutdown on tunnel destroy

2018-02-12 Thread James Chapman
00 00 00 <49> 81 3c 24 80 93 3f 83 b8 00 00 00 00 44 0f 44 c0 83 fe 01 0f RIP: __lock_acquire+0x263/0x1630 RSP: 88001a37fc70 CR2: 00a0 Fixes: 309795f4be ("l2tp: Add netlink control API for L2TP") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 11 ++-

[PATCH net-next v3 12/16] l2tp: simplify l2tp_tunnel_closeall

2018-02-12 Thread James Chapman
ow unused so is removed. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 32 net/l2tp/l2tp_core.h | 1 - 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 55b1f312fedc..c909fe9273c9 100644

[PATCH net-next v3 15/16] l2tp: remove unwanted error message

2018-02-12 Thread James Chapman
If when creating a new tunnel, the indicated fd is closed by another thread, we emit an error message about it. e.g. l2tp_core: tunl 4: sockfd_lookup(fd=3) returned -9 It's not useful so remove it. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 2 -- 1 file changed, 2 dele

[PATCH net-next v3 10/16] l2tp: add session_free callback

2018-02-12 Thread James Chapman
session. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 7 +-- net/l2tp/l2tp_core.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 869dec89ff0f..d6306ba2d78e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp

[PATCH net-next v3 14/16] l2tp: remove redundant sk_user_data check when creating tunnels

2018-02-12 Thread James Chapman
l2tp_tunnel_create now checks sk_user_data so this check is redundant Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 8 1 file changed, 8 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index c909fe9273c9..a91cd384e397 100644 --- a/net/l2tp/l2tp_core.c

[PATCH net-next v3 13/16] l2tp: refactor ppp session cleanup paths

2018-02-12 Thread James Chapman
400f2...@syzkaller.appspotmail.com Reported-by: syzbot+6e6a5ec8de31a94cd...@syzkaller.appspotmail.com Reported-by: syzbot+19c09769f14b48810...@syzkaller.appspotmail.com Reported-by: syzbot+347bd5acde002e353...@syzkaller.appspotmail.com Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c

[PATCH net-next v3 16/16] l2tp: make __l2tp_session_unhash internal

2018-02-12 Thread James Chapman
__l2tp_session_unhash is now only used internally so there is no reason to expose it to other l2tp modules. Rename it l2tp_session_unhash while we're at it. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 5 ++--- net/l2tp/l2tp_core.h | 1 - 2 files changed, 2 insertions(+), 4 dele

Re: [PATCH net-next v2 03/16] l2tp: don't use inet_shutdown on tunnel destroy

2018-02-12 Thread James Chapman
On 12/02/18 16:22, David Miller wrote: > From: James Chapman > Date: Mon, 12 Feb 2018 10:11:07 + > >> Previously, if a tunnel was closed, we called inet_shutdown to mark >> the socket as unconnected such that userspace would get errors and >> then close the s

[PATCH net-next v2 06/16] l2tp: refactor session lifetime handling

2018-02-12 Thread James Chapman
Simplify relationship with tunnel such that the session holds a ref on the tunnel, not its socket. This guarantees that the tunnel is always extant if one or more sessions exists on the tunnel. If the session has a socket (ppp), have it hold a ref on the socket until the session is destroyed. Sinc

[PATCH net-next v2 12/16] l2tp: simplify l2tp_tunnel_closeall

2018-02-12 Thread James Chapman
Since session destroy now uses a workqueue, let l2tp_session_delete handle all the work of destroying a session. Don't remove the session from the tunnel's list immediately. The tunnel will remain extant until all of its sessions are gone anyway. The session's dead flag is now unused so is removed

[PATCH net-next v2 03/16] l2tp: don't use inet_shutdown on tunnel destroy

2018-02-12 Thread James Chapman
Previously, if a tunnel was closed, we called inet_shutdown to mark the socket as unconnected such that userspace would get errors and then close the socket. This could race with userspace closing the socket. Instead, leave userspace to close the socket in its own time (our tunnel will be detached

[PATCH net-next v2 09/16] l2tp: refactor pppol2tp_connect

2018-02-12 Thread James Chapman
It's hard to understand pppol2tp_connect so split it up into separate functions and document it better. Fixes: fd558d186d ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") --- net/l2tp/l2tp_ppp.c | 307 +++- 1 file changed, 185 insert

[PATCH net-next v2 02/16] l2tp: add RCU read lock to protect tunnel ptr in ip socket destroy

2018-02-12 Thread James Chapman
If an L2TPIP socket is closed, add RCU protection when we deref sk_user_data to prevent races with another thread closing the same tunnel. Fixes: 0d76751fad ("l2tp: Add L2TPv3 IP encapsulation (no UDP) support") refcount_t: increment on 0; use-after-free. WARNING: CPU: 2 PID: 2892 at lib/refcou

[PATCH net-next v2 01/16] l2tp: update sk_user_data while holding sk_callback_lock

2018-02-12 Thread James Chapman
Since L2TP hooks on sockets opened by userspace using sk_user_data, we may race with other socket families that attempt to use the same socket. This problem was discovered by syzbot using AF_KCM. KCM has since been modified to use only TCP sockets to avoid hitting this issue but we should prevent

[PATCH net-next v2 11/16] l2tp: do session destroy using a workqueue

2018-02-12 Thread James Chapman
Handle session destroy in the same way as we handle tunnel destroy - through a workqueue. Sessions can be destroyed either because its socket is closed (if it has a socket) or by netlink request. A workqueue synchronises these. --- net/l2tp/l2tp_core.c | 30 +++--- net/l2tp

[PATCH net-next v2 16/16] l2tp: make __l2tp_session_unhash internal

2018-02-12 Thread James Chapman
__l2tp_session_unhash is now only used internally so there is no reason to expose it to other l2tp modules. Rename it l2tp_session_unhash while we're at it. --- net/l2tp/l2tp_core.c | 5 ++--- net/l2tp/l2tp_core.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/net/l2tp/l2tp_

[PATCH net-next v2 14/16] l2tp: remove redundant sk_user_data check when creating tunnels

2018-02-12 Thread James Chapman
l2tp_tunnel_create now checks sk_user_data so this check is redundant --- net/l2tp/l2tp_core.c | 8 1 file changed, 8 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index c909fe9273c9..a91cd384e397 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -14

[PATCH net-next v2 13/16] l2tp: refactor ppp session cleanup paths

2018-02-12 Thread James Chapman
Use l2tp core's session_free callback to drive the ppp session cleanup. PPP sessions are cleaned up by RCU. The PPP session socket is allowed to close only when the session is freed. With this patch, the following syzbot bug reports are finally fixed. Reported-by: syzbot+9df43faf09bd400f2...@syzk

[PATCH net-next v2 04/16] l2tp: refactor tunnel lifetime handling wrt its socket

2018-02-12 Thread James Chapman
Ensure that the tunnel's socket is always extant while the tunnel object exists. Hold a ref on the socket until the tunnel is destroyed and ensure that all tunnel destroy paths go through a common function (l2tp_tunnel_delete). Since the tunnel's socket is now guaranteed to exist if the tunnel exi

[PATCH net-next v2 08/16] l2tp: hide session from pppol2tp_sock_to_session if it is closing

2018-02-12 Thread James Chapman
--- net/l2tp/l2tp_ppp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index ff95a4d4eac5..947066b3d6d8 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -172,8 +172,16 @@ static inline struct l2tp_session *pppol

[PATCH net-next v2 00/16] l2tp: fix API races discovered by syzbot

2018-02-12 Thread James Chapman
) its socket closed. (patches 10-13) 6. Misc cleanups made possible by the refactoring done in this series. (patches 14-16) Changes in v2:- Fix compile error that would have broken bisect. James Chapman (16): l2tp: update sk_user_data while holding sk_callback_lock l2tp: add RCU

[PATCH net-next v2 07/16] l2tp: hide sessions if they are closing

2018-02-12 Thread James Chapman
Replace the dead flag in the session context with a closing flag and spinlock. Check it in session lookup functions such that we don't try to access session data while it is being destroyed. --- net/l2tp/l2tp_core.c | 34 +- net/l2tp/l2tp_core.h | 2 ++ 2 files cha

[PATCH net-next v2 15/16] l2tp: remove unwanted error message

2018-02-12 Thread James Chapman
If when creating a new tunnel, the indicated fd is closed by another thread, we emit an error message about it. e.g. l2tp_core: tunl 4: sockfd_lookup(fd=3) returned -9 It's not useful so remove it. --- net/l2tp/l2tp_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/l2tp/l2tp_cor

[PATCH net-next v2 05/16] l2tp: use tunnel closing flag

2018-02-12 Thread James Chapman
The tunnel's closing flag is set when the tunnel is being destroyed. Use it to reject new sessions and remove acpt_newsess which was doing the same thing. Also prevent the tunnel being seen in l2tp_tunnel_get lookups. --- net/l2tp/l2tp_core.c | 27 +-- net/l2tp/l2tp_core.h

[PATCH net-next v2 10/16] l2tp: add session_free callback

2018-02-12 Thread James Chapman
When a session refcount hits 0, the session is freed via l2tp_session_free. Some pseudowires (ppp, eth) may have additional resources to free when this happens. Add a session_free callback that can be used by pseudowires to override the default kfree. The callback is responsible for freeing the ses

[PATCH net-next 02/16] l2tp: add RCU read lock to protect tunnel ptr in ip socket destroy

2018-02-09 Thread James Chapman
4 02 5d c3 80 3d 97 87 bb 01 00 75 f5 48 c7 c7 58 3e cc 82 c6 05 87 87 bb 01 Signed-off-by: James Chapman --- net/l2tp/l2tp_ip.c | 5 - net/l2tp/l2tp_ip6.c | 5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index ff61124fdf59..42

[PATCH net-next 01/16] l2tp: update sk_user_data while holding sk_callback_lock

2018-02-09 Thread James Chapman
2/0x670 net/l2tp/l2tp_ppp.c:304 RSP: 8801d4887438 Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 21 ++--- net/l2tp/l2tp_ppp.c | 8 ++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 194a7483bb93..de7

[PATCH net-next 15/16] l2tp: remove unwanted error message

2018-02-09 Thread James Chapman
If when creating a new tunnel, the indicated fd is closed by another thread, we emit an error message about it. e.g. l2tp_core: tunl 4: sockfd_lookup(fd=3) returned -9 It's not useful so remove it. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 2 -- 1 file changed, 2 dele

[PATCH net-next 09/16] l2tp: refactor pppol2tp_connect

2018-02-09 Thread James Chapman
It's hard to understand pppol2tp_connect so split it up into separate functions and document it better. Fixes: fd558d186d ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Signed-off-by: James Chapman --- net/l2tp/l

[PATCH net-next 05/16] l2tp: use tunnel closing flag

2018-02-09 Thread James Chapman
The tunnel's closing flag is set when the tunnel is being destroyed. Use it to reject new sessions and remove acpt_newsess which was doing the same thing. Also prevent the tunnel being seen in l2tp_tunnel_get lookups. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c

[PATCH net-next 04/16] l2tp: refactor tunnel lifetime handling wrt its socket

2018-02-09 Thread James Chapman
no longer used so is removed. Fixes: 80d84ef3ff1dd ("l2tp: prevent l2tp_tunnel_delete racing with userspace close") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 128 ++- net/l2tp/l2tp_core.h | 26 ++- net/l2tp/l2tp_

[PATCH net-next 10/16] l2tp: add session_free callback

2018-02-09 Thread James Chapman
session. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 7 +-- net/l2tp/l2tp_core.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 869dec89ff0f..d6306ba2d78e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp

[PATCH net-next 13/16] l2tp: refactor ppp session cleanup paths

2018-02-09 Thread James Chapman
400f2...@syzkaller.appspotmail.com Reported-by: syzbot+6e6a5ec8de31a94cd...@syzkaller.appspotmail.com Reported-by: syzbot+19c09769f14b48810...@syzkaller.appspotmail.com Reported-by: syzbot+347bd5acde002e353...@syzkaller.appspotmail.com Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c

[PATCH net-next 07/16] l2tp: hide sessions if they are closing

2018-02-09 Thread James Chapman
Replace the dead flag in the session context with a closing flag and spinlock. Check it in session lookup functions such that we don't try to access session data while it is being destroyed. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 34 +- net

[PATCH net-next 16/16] l2tp: make __l2tp_session_unhash internal

2018-02-09 Thread James Chapman
__l2tp_session_unhash is now only used internally so there is no reason to expose it to other l2tp modules. Rename it l2tp_session_unhash while we're at it. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 5 ++--- net/l2tp/l2tp_core.h | 1 - 2 files changed, 2 insertions(+), 4 dele

[PATCH net-next 11/16] l2tp: do session destroy using a workqueue

2018-02-09 Thread James Chapman
Handle session destroy in the same way as we handle tunnel destroy - through a workqueue. Sessions can be destroyed either because its socket is closed (if it has a socket) or by netlink request. A workqueue synchronises these. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 30

[PATCH net-next 14/16] l2tp: remove redundant sk_user_data check when creating tunnels

2018-02-09 Thread James Chapman
l2tp_tunnel_create now checks sk_user_data so this check is redundant Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 8 1 file changed, 8 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index c909fe9273c9..a91cd384e397 100644 --- a/net/l2tp/l2tp_core.c

[PATCH net-next 03/16] l2tp: don't use inet_shutdown on tunnel destroy

2018-02-09 Thread James Chapman
f ff 1f 00 00 0f 87 7a 13 00 00 45 85 f6 49 8b 85 68 08 00 00 0f 84 ae 03 00 00 c7 44 24 18 00 00 00 00 e9 f0 00 00 00 <49> 81 3c 24 80 93 3f 83 b8 00 00 00 00 44 0f 44 c0 83 fe 01 0f RIP: __lock_acquire+0x263/0x1630 RSP: 88001a37fc70 CR2: 00a0 Signed-off-by: James Chapma

[PATCH net-next 00/16] l2tp: fix API races discovered by syzbot

2018-02-09 Thread James Chapman
) its socket closed. (patches 10-13) 6. Misc cleanups made possible by the refactoring done in this series. (patches 14-16) James Chapman (16): l2tp: update sk_user_data while holding sk_callback_lock l2tp: add RCU read lock to protect tunnel ptr in ip socket destroy l2tp: don'

[PATCH net-next 06/16] l2tp: refactor session lifetime handling

2018-02-09 Thread James Chapman
inated tunnels") Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c | 7 ++- net/l2tp/l2tp_ppp.c | 36 ++-- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 691fe9368d91..477b96cf8ab3 1

[PATCH net-next 12/16] l2tp: simplify l2tp_tunnel_closeall

2018-02-09 Thread James Chapman
Since session destroy now uses a workqueue, let l2tp_session_delete handle all the work of destroying a session. Don't remove the session from the tunnel's list immediately. The tunnel will remain extant until all of its sessions are gone anyway. Signed-off-by: James Chapman ---

[PATCH net-next 08/16] l2tp: hide session from pppol2tp_sock_to_session if it is closing

2018-02-09 Thread James Chapman
Signed-off-by: James Chapman --- net/l2tp/l2tp_ppp.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index ff95a4d4eac5..947066b3d6d8 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -172,8 +172,16 @@ static

l2tp: fixes for syzbot reports - in progress

2018-02-02 Thread James Chapman
I'm currently working on fixes for various l2tp problems reported by syzbot. If anyone else is also working on this, please get back to me so that we can avoid duplicate effort. The syzbot reports are: 9df43faf0 KASAN: use-after-free Read in pppol2tp_connect 6e6a5ec8d general protection fault in p

Re: [PATCH net-next] kcm: do not attach sockets if sk_user_data is already used

2018-01-18 Thread James Chapman
On 18 January 2018 at 16:29, Guillaume Nault wrote: > On Thu, Jan 18, 2018 at 03:40:52PM +0000, James Chapman wrote: >> On 18 January 2018 at 15:18, Guillaume Nault wrote: >> > On Wed, Jan 17, 2018 at 02:25:38PM -0500, David Miller wrote: >> >> If all else was equa

Re: [PATCH net-next] kcm: do not attach sockets if sk_user_data is already used

2018-01-18 Thread James Chapman
On 18 January 2018 at 15:18, Guillaume Nault wrote: > On Wed, Jan 17, 2018 at 02:25:38PM -0500, David Miller wrote: >> From: James Chapman >> Date: Wed, 17 Jan 2018 11:13:33 + >> >> > On 16 January 2018 at 19:00, David Miller wrote: >> >> From: To

Re: [PATCH v3 net-next 0/4] l2tp: set l2specific_len based on l2specific_type

2018-01-17 Thread James Chapman
attribute as not used >> > Nice. Thanks for doing this work Lorenzo. Acked-by: James Chapman

Re: [PATCH net-next] kcm: do not attach sockets if sk_user_data is already used

2018-01-17 Thread James Chapman
On 16 January 2018 at 19:00, David Miller wrote: > From: Tom Herbert > Date: Tue, 16 Jan 2018 09:36:41 -0800 > >> sk_user_data is set with the sk_callback lock held in code below. >> Should be able to take the lock earlier can do this check under the >> lock. > > csock, and this csk, is obtained

Re: [PATCH v2 net-next 1/5] l2tp: fix switch default error handling in l2tp_nl_cmd_session_create()

2018-01-15 Thread James Chapman
On 15 January 2018 at 21:18, Lorenzo Bianconi wrote: >> On Sun, Jan 14, 2018 at 03:50:54PM +0100, Lorenzo Bianconi wrote: >>> Although this issue is harmless since that code path is protected by the >>> check on l2tp_nl_cmd_ops[]/l2tp_nl_cmd_ops[]->session_create(), fix error >>> handling for L2TP

[PATCH net-next] kcm: do not attach sockets if sk_user_data is already used

2018-01-14 Thread James Chapman
pp.c:176 [inline] RSP: 8801d4887438 RIP: pppol2tp_sendmsg+0x512/0x670 net/l2tp/l2tp_ppp.c:304 RSP: 8801d4887438 Reported-by: syzbot+114b15f2be420a888...@syzkaller.appspotmail.com Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module") Signed-off-by: James Chapman

Re: [PATCH net-next] l2tp: adjust comments about L2TPv3 offsets

2018-01-07 Thread James Chapman
; + * Cookie value and sublayer format are negotiated with the peer when > + * the session is set up. Unlike L2TPv2, we do not need to parse the > + * packet header to determine if optional fields are present. > * > * Caller must already have parsed the frame and determined that it is > * a data (not control) frame before coming here. Fields up to the Acked-by: James Chapman

Re: [PATCH net-next 3/4] l2tp: remove configurable payload offset

2018-01-04 Thread James Chapman
On 04/01/18 10:25, Guillaume Nault wrote: >> diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c >> index eb69411..2c30587 100644 >> --- a/net/l2tp/l2tp_debugfs.c >> +++ b/net/l2tp/l2tp_debugfs.c >> @@ -180,8 +180,8 @@ static void l2tp_dfs_seq_session_show(struct seq_file >> *m, void *v

[PATCH net-next 0/4] l2tp: remove configurable offset parameters

2018-01-03 Thread James Chapman
number of bytes padding between L2TPv3 header and payload. This is not compliant with L2TPv3 RFC3931. So this change removes the configurable offset altogether while retaining L2TP_ATTR_OFFSET in the API for backwards compatibility. If L2TP_ATTR_OFFSET is given, its value is now silently igno

[PATCH net-next 4/4] l2tp: add comment in API header that L2TP_ATTR_OFFSET is not used

2018-01-03 Thread James Chapman
Signed-off-by: James Chapman --- include/uapi/linux/l2tp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index d84ce5c..f78eef4 100644 --- a/include/uapi/linux/l2tp.h +++ b/include/uapi/linux/l2tp.h @@ -94,7 +94,7

[PATCH net-next 2/4] l2tp: revert "l2tp: fix missing print session offset info"

2018-01-03 Thread James Chapman
Revert commit 820da5357572 ("l2tp: fix missing print session offset info"). The peer_offset parameter is removed. Signed-off-by: James Chapman --- net/l2tp/l2tp_netlink.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c ind

[PATCH net-next 3/4] l2tp: remove configurable payload offset

2018-01-03 Thread James Chapman
FSET value is ignored. Signed-off-by: James Chapman --- net/l2tp/l2tp_core.c| 14 -- net/l2tp/l2tp_core.h| 3 --- net/l2tp/l2tp_debugfs.c | 4 ++-- net/l2tp/l2tp_netlink.c | 3 --- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/net/l2tp/l2tp_core.c

[PATCH net-next 1/4] l2tp: revert "l2tp: add peer_offset parameter"

2018-01-03 Thread James Chapman
Revert commit f15bc54eeecd ("l2tp: add peer_offset parameter"). This is removed because it is adding another configurable offset and configurable offsets are being removed. Signed-off-by: James Chapman --- include/uapi/linux/l2tp.h | 1 - net/l2tp/l2tp_core.c | 3 +--

Re: [PATCH net-next 2/2] l2tp: add peer_offset parameter

2018-01-02 Thread James Chapman
On 02/01/18 20:08, James Chapman wrote: On 02/01/18 18:05, Guillaume Nault wrote: Lorenzo, is this being added to fix interoperability with another L2TPv3 implementation? If so, can you share more details? Hi James, I introduced peer_offset parameter to fix a specific setup where tunnel

Re: [PATCH net-next 2/2] l2tp: add peer_offset parameter

2018-01-02 Thread James Chapman
On 02/01/18 17:50, Guillaume Nault wrote: On Fri, Dec 29, 2017 at 06:53:56PM +, James Chapman wrote: On 28/12/17 19:45, Guillaume Nault wrote: Here we have an option that: * creates invalid packets (AFAIK), * is buggy and leaks memory on the network, * doesn't seem to hav

Re: [PATCH net-next 2/2] l2tp: add peer_offset parameter

2018-01-02 Thread James Chapman
On 02/01/18 19:28, Lorenzo Bianconi wrote: Lorenzo, is this being added to fix interoperability with another L2TPv3 implementation? If so, can you share more details? Hi James, I introduced peer_offset parameter to fix a specific setup where tunnel endpoints running L2TPv3 would use different

Re: [PATCH net-next 2/2] l2tp: add peer_offset parameter

2018-01-02 Thread James Chapman
On 02/01/18 18:05, Guillaume Nault wrote: Lorenzo, is this being added to fix interoperability with another L2TPv3 implementation? If so, can you share more details? Hi James, I introduced peer_offset parameter to fix a specific setup where tunnel endpoints running L2TPv3 would use different v

Re: [PATCH net-next 2/2] l2tp: add peer_offset parameter

2017-12-29 Thread James Chapman
Sorry for only just seeing this (vacation). On 28/12/17 19:45, Guillaume Nault wrote: On Thu, Dec 28, 2017 at 07:23:48PM +0100, Lorenzo Bianconi wrote: On Dec 28, Guillaume Nault wrote: After a quick review of L2TPv3 and pseudowires RFCs, I still don't see how adding some padding between the L

Re: Fw: [Bug 197099] New: Kernel panic in interrupt [l2tp_ppp]

2017-10-06 Thread James Chapman
On 6 October 2017 at 05:45, SviMik wrote: > 2017-10-04 10:49 GMT+03:00 James Chapman : >> On 3 October 2017 at 08:27, James Chapman wrote: >>> For capturing complete oops messages, have you tried setting up >>> netconsole? You might also find the full text in the syslo

Re: Fw: [Bug 197099] New: Kernel panic in interrupt [l2tp_ppp]

2017-10-04 Thread James Chapman
On 3 October 2017 at 08:27, James Chapman wrote: > On 2 October 2017 at 19:35, SviMik wrote: >> Hi, James! >> >> No, I'm suffering from kernel panics since I started using 4.x >> kernels. > It's interesting that you are seeing l2tp issues since switchi

Re: Fw: [Bug 197099] New: Kernel panic in interrupt [l2tp_ppp]

2017-10-03 Thread James Chapman
syslog on reboot. > 2017-10-02 16:56 GMT+03:00 Eric Dumazet : >> CC svi...@gmail.com so that he is aware of this netdev thread. >> >> On Mon, 2017-10-02 at 14:32 +0100, James Chapman wrote: >>> This seems to be a NULL pointer exception caused by tunnel->sock being >

Re: Fw: [Bug 197099] New: Kernel panic in interrupt [l2tp_ppp]

2017-10-02 Thread James Chapman
This seems to be a NULL pointer exception caused by tunnel->sock being NULL at the call to bh_lock_sock() in l2tp_xmit_skb() at l2tp_core.c:1135. tunnel->sock is set NULL in l2tp_core's tunnel socket destructor. At the moment, I don't understand how this happens because pppol2tp_xmit() does a soc

Re: [PATCH net-next 2/2] l2tp: define "l2tpeth" device type

2017-04-25 Thread James Chapman
On 24/04/17 13:16, Guillaume Nault wrote: > Export type of l2tpeth interfaces to userspace > (/sys/class/net//uevent). > > Signed-off-by: Guillaume Nault Acked-by: James Chapman

Re: [PATCH net-next 1/2] l2tp: set name_assign_type for devices created by l2tp_eth.c

2017-04-25 Thread James Chapman
On 24/04/17 13:16, Guillaume Nault wrote: > Export naming scheme used when creating l2tpeth interfaces > (/sys/class/net//name_assign_type). This let userspace know if > the device's name has been generated automatically or defined manually. > > Signed-off-by: Guillaume Na

Re: [PATCH net-next v4 1/2] New kernel function to get IP overhead on a socket.

2017-03-24 Thread James Chapman
>>> >>> Signed-off-by: R. Parameswaran >> Just use the IPv4/IPv6 header size for now, just like the VXLAN >> driver does. >> > Actually, that's how the original posting was - it was changed in > response to a review comment from James Chapman requesting

  1   2   3   >