summaryrefslogtreecommitdiff
path: root/net/netlabel
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2017-09-26 17:16:43 +0300
committerDavid S. Miller <davem@davemloft.net>2017-09-26 20:24:34 +0300
commit62b982eeb4589b2e6d7c01a90590e3a4c2b2ca19 (patch)
tree49dabd03d76177db735d196ecf9883191d6ac5cc /net/netlabel
parent36f6ee22d2d66046e369757ec6bbe1c482957ba6 (diff)
downloadlinux-62b982eeb4589b2e6d7c01a90590e3a4c2b2ca19.tar.xz
l2tp: fix race condition in l2tp_tunnel_delete
If we try to delete the same tunnel twice, the first delete operation does a lookup (l2tp_tunnel_get), finds the tunnel, calls l2tp_tunnel_delete, which queues it for deletion by l2tp_tunnel_del_work. The second delete operation also finds the tunnel and calls l2tp_tunnel_delete. If the workqueue has already fired and started running l2tp_tunnel_del_work, then l2tp_tunnel_delete will queue the same tunnel a second time, and try to free the socket again. Add a dead flag to prevent firing the workqueue twice. Then we can remove the check of queue_work's result that was meant to prevent that race but doesn't. Reproducer: ip l2tp add tunnel tunnel_id 3000 peer_tunnel_id 4000 local 192.168.0.2 remote 192.168.0.1 encap udp udp_sport 5000 udp_dport 6000 ip l2tp add session name l2tp1 tunnel_id 3000 session_id 1000 peer_session_id 2000 ip link set l2tp1 up ip l2tp del tunnel tunnel_id 3000 ip l2tp del tunnel tunnel_id 3000 Fixes: f8ccac0e4493 ("l2tp: put tunnel socket release on a workqueue") Reported-by: Jianlin Shi <jishi@redhat.com> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Acked-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlabel')
0 files changed, 0 insertions, 0 deletions