* [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed
@ 2008-06-04 20:56 James Chapman
2008-06-04 22:08 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: James Chapman @ 2008-06-04 20:56 UTC (permalink / raw)
To: netdev
If an L2TP daemon closes a tunnel socket while packets are queued in
the tunnel's reorder queue, a kernel warning is logged because the
socket is closed while skbs are still referencing it. The fix is to
purge the queue in the socket's release handler.
WARNING: at include/net/sock.h:351 udp_lib_unhash+0x41/0x68()
Pid: 12998, comm: openl2tpd Not tainted 2.6.25 #8
[<c0423c58>] warn_on_slowpath+0x41/0x51
[<c05d33a7>] udp_lib_unhash+0x41/0x68
[<c059424d>] sk_common_release+0x23/0x90
[<c05d16be>] udp_lib_close+0x8/0xa
[<c05d8684>] inet_release+0x42/0x48
[<c0592599>] sock_release+0x14/0x60
[<c059299f>] sock_close+0x29/0x30
[<c046ef52>] __fput+0xad/0x15b
[<c046f1d9>] fput+0x17/0x19
[<c046c8c4>] filp_close+0x50/0x5a
[<c046da06>] sys_close+0x69/0x9f
[<c04048ce>] syscall_call+0x7/0xb
Signed-off-by: James Chapman <jchapman@katalix.com>
Index: linux-2.6.25/drivers/net/pppol2tp.c
===================================================================
--- linux-2.6.25.orig/drivers/net/pppol2tp.c
+++ linux-2.6.25/drivers/net/pppol2tp.c
@@ -1318,6 +1318,7 @@ out:
static int pppol2tp_release(struct socket *sock)
{
struct sock *sk = sock->sk;
+ struct pppol2tp_session *session;
int error;
if (!sk)
@@ -1335,9 +1336,18 @@ static int pppol2tp_release(struct socke
sock_orphan(sk);
sock->sk = NULL;
+ session = pppol2tp_sock_to_session(sk);
+
/* Purge any queued data */
skb_queue_purge(&sk->sk_receive_queue);
skb_queue_purge(&sk->sk_write_queue);
+ if (session != NULL) {
+ struct sk_buff *skb;
+ while ((skb = skb_dequeue(&session->reorder_q))) {
+ kfree_skb(skb);
+ sock_put(sk);
+ }
+ }
release_sock(sk);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed
2008-06-04 20:56 [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed James Chapman
@ 2008-06-04 22:08 ` David Miller
2008-06-04 22:11 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-06-04 22:08 UTC (permalink / raw)
To: jchapman; +Cc: netdev
From: James Chapman <jchapman@katalix.com>
Date: Wed, 4 Jun 2008 21:56:44 +0100
> If an L2TP daemon closes a tunnel socket while packets are queued in
> the tunnel's reorder queue, a kernel warning is logged because the
> socket is closed while skbs are still referencing it. The fix is to
> purge the queue in the socket's release handler.
>
> WARNING: at include/net/sock.h:351 udp_lib_unhash+0x41/0x68()
> Pid: 12998, comm: openl2tpd Not tainted 2.6.25 #8
> [<c0423c58>] warn_on_slowpath+0x41/0x51
> [<c05d33a7>] udp_lib_unhash+0x41/0x68
> [<c059424d>] sk_common_release+0x23/0x90
> [<c05d16be>] udp_lib_close+0x8/0xa
> [<c05d8684>] inet_release+0x42/0x48
> [<c0592599>] sock_release+0x14/0x60
> [<c059299f>] sock_close+0x29/0x30
> [<c046ef52>] __fput+0xad/0x15b
> [<c046f1d9>] fput+0x17/0x19
> [<c046c8c4>] filp_close+0x50/0x5a
> [<c046da06>] sys_close+0x69/0x9f
> [<c04048ce>] syscall_call+0x7/0xb
>
> Signed-off-by: James Chapman <jchapman@katalix.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed
2008-06-04 22:08 ` David Miller
@ 2008-06-04 22:11 ` David Miller
2008-06-04 22:33 ` James Chapman
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2008-06-04 22:11 UTC (permalink / raw)
To: jchapman; +Cc: netdev
From: David Miller <davem@davemloft.net>
Date: Wed, 04 Jun 2008 15:08:35 -0700 (PDT)
> Applied, thanks.
James your second patch doesn't apply cleanly:
@@ -1066,7 +1100,7 @@ static int pppol2tp_xmit(struct ppp_chan
dst_release(skb->dst);
skb->dst = dst_clone(__sk_dst_get(sk_tun));
skb_orphan(skb);
- skb->sk = sk_tun;
+ pppol2tp_skb_set_owner_w(skb, sk_tun);
/* Queue the packet to IP for output */
len = skb->len;
There is no skb_orphan() call in the current pppol2tp.c code.
Please always prepare your patches against the current tree.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed
2008-06-04 22:11 ` David Miller
@ 2008-06-04 22:33 ` James Chapman
2008-06-04 22:36 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: James Chapman @ 2008-06-04 22:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Wed, 04 Jun 2008 15:08:35 -0700 (PDT)
>
>> Applied, thanks.
>
> James your second patch doesn't apply cleanly:
>
> @@ -1066,7 +1100,7 @@ static int pppol2tp_xmit(struct ppp_chan
> dst_release(skb->dst);
> skb->dst = dst_clone(__sk_dst_get(sk_tun));
> skb_orphan(skb);
> - skb->sk = sk_tun;
> + pppol2tp_skb_set_owner_w(skb, sk_tun);
>
> /* Queue the packet to IP for output */
> len = skb->len;
>
> There is no skb_orphan() call in the current pppol2tp.c code.
>
> Please always prepare your patches against the current tree.
My apologies. I sent the wrong patch version. The skb_orphan() call was
moved in the truesize patch that has already been applied. Shall I resend?
--
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-04 22:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 20:56 [PATCH 1/2][L2TP]: Fix possible WARN_ON from socket code when UDP socket is closed James Chapman
2008-06-04 22:08 ` David Miller
2008-06-04 22:11 ` David Miller
2008-06-04 22:33 ` James Chapman
2008-06-04 22:36 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).