diff options
author | Tom Parkin <tparkin@katalix.com> | 2013-01-22 05:13:48 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-29 15:43:02 -0500 |
commit | 80d84ef3ff1ddc7a829c58980a9dd566a8af5203 (patch) | |
tree | 115869b9fccce4bb2ecc7dd5a0ec2ba203802929 /net/sched | |
parent | fc16e884a2320198b8cb7bc2fdcf6b4485e79709 (diff) |
l2tp: prevent l2tp_tunnel_delete racing with userspace close
If a tunnel socket is created by userspace, l2tp hooks the socket destructor
in order to clean up resources if userspace closes the socket or crashes. It
also caches a pointer to the struct sock for use in the data path and in the
netlink interface.
While it is safe to use the cached sock pointer in the data path, where the
skb references keep the socket alive, it is not safe to use it elsewhere as
such access introduces a race with userspace closing the socket. In
particular, l2tp_tunnel_delete is prone to oopsing if a multithreaded
userspace application closes a socket at the same time as sending a netlink
delete command for the tunnel.
This patch fixes this oops by forcing l2tp_tunnel_delete to explicitly look up
a tunnel socket held by userspace using sockfd_lookup().
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/sched')
0 files changed, 0 insertions, 0 deletions