diff options
author | James Chapman <jchapman@katalix.com> | 2008-06-04 18:07:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-04 18:07:32 -0400 |
commit | 199f7d24ae59894243687a234a909f44a8724506 (patch) | |
tree | 396efe66b51628fc0077de74b00c66957cd1f58d /drivers | |
parent | b4496d44c6bd8b2da8d370ef49c4b008ce82370b (diff) |
lt2p: Fix possible WARN_ON from socket code when UDP socket is closed
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/pppol2tp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 8db342f2fdc9..04c7e5b407fd 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -1279,6 +1279,7 @@ out: | |||
1279 | static int pppol2tp_release(struct socket *sock) | 1279 | static int pppol2tp_release(struct socket *sock) |
1280 | { | 1280 | { |
1281 | struct sock *sk = sock->sk; | 1281 | struct sock *sk = sock->sk; |
1282 | struct pppol2tp_session *session; | ||
1282 | int error; | 1283 | int error; |
1283 | 1284 | ||
1284 | if (!sk) | 1285 | if (!sk) |
@@ -1296,9 +1297,18 @@ static int pppol2tp_release(struct socket *sock) | |||
1296 | sock_orphan(sk); | 1297 | sock_orphan(sk); |
1297 | sock->sk = NULL; | 1298 | sock->sk = NULL; |
1298 | 1299 | ||
1300 | session = pppol2tp_sock_to_session(sk); | ||
1301 | |||
1299 | /* Purge any queued data */ | 1302 | /* Purge any queued data */ |
1300 | skb_queue_purge(&sk->sk_receive_queue); | 1303 | skb_queue_purge(&sk->sk_receive_queue); |
1301 | skb_queue_purge(&sk->sk_write_queue); | 1304 | skb_queue_purge(&sk->sk_write_queue); |
1305 | if (session != NULL) { | ||
1306 | struct sk_buff *skb; | ||
1307 | while ((skb = skb_dequeue(&session->reorder_q))) { | ||
1308 | kfree_skb(skb); | ||
1309 | sock_put(sk); | ||
1310 | } | ||
1311 | } | ||
1302 | 1312 | ||
1303 | release_sock(sk); | 1313 | release_sock(sk); |
1304 | 1314 | ||