diff options
author | Tom Parkin <tparkin@katalix.com> | 2013-03-19 06:11:13 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-20 12:10:38 -0400 |
commit | 9980d001cec86c3c75f3a6008ddb73c397ea3b3e (patch) | |
tree | 85c5d87a35ad66c01cc37d6c7ac2b9d29f477daf /kernel | |
parent | 44046a593eb770dbecdabf1c82bcd252f2a8337b (diff) | |
download | linux-9980d001cec86c3c75f3a6008ddb73c397ea3b3e.tar.bz2 |
l2tp: add udp encap socket destroy handler
L2TP sessions hold a reference to the tunnel socket to prevent it going away
while sessions are still active. However, since tunnel destruction is handled
by the sock sk_destruct callback there is a catch-22: a tunnel with sessions
cannot be deleted since each session holds a reference to the tunnel socket.
If userspace closes a managed tunnel socket, or dies, the tunnel will persist
and it will be neccessary to individually delete the sessions using netlink
commands. This is ugly.
To prevent this occuring, this patch leverages the udp encapsulation socket
destroy callback to gain early notification when the tunnel socket is closed.
This allows us to safely close the sessions running in the tunnel, dropping
the tunnel socket references in the process. The tunnel socket is then
destroyed as normal, and the tunnel resources deallocated in sk_destruct.
While we're at it, ensure that l2tp_tunnel_closeall correctly drops session
references to allow the sessions to be deleted rather than leaking.
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 'kernel')
0 files changed, 0 insertions, 0 deletions