diff options
author | Tom Parkin <tparkin@katalix.com> | 2013-03-19 07:11:15 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-20 17:10:38 +0100 |
commit | 936063175afd895913a5e9db77e1a0ef43ea44ea (patch) | |
tree | f98e60750ccd05beb835cd5cc652432bca22a6ad /net/l2tp/l2tp_ip.c | |
parent | l2tp: export l2tp_tunnel_closeall (diff) | |
download | linux-936063175afd895913a5e9db77e1a0ef43ea44ea.tar.xz linux-936063175afd895913a5e9db77e1a0ef43ea44ea.zip |
l2tp: close sessions in ip socket destroy callback
l2tp_core hooks UDP's .destroy handler to gain advance warning of a tunnel
socket being closed from userspace. We need to do the same thing for
IP-encapsulation sockets.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_ip.c')
-rw-r--r-- | net/l2tp/l2tp_ip.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 7f41b7051269..571db8dd2292 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c @@ -228,10 +228,16 @@ static void l2tp_ip_close(struct sock *sk, long timeout) static void l2tp_ip_destroy_sock(struct sock *sk) { struct sk_buff *skb; + struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) kfree_skb(skb); + if (tunnel) { + l2tp_tunnel_closeall(tunnel); + sock_put(sk); + } + sk_refcnt_debug_dec(sk); } |