diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2016-09-02 10:22:54 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-05-10 10:26:31 +0200 |
commit | 35a017009751dc18b365fe9ec8886a2632f42c18 (patch) | |
tree | d10b928d13c01ae8e350308de88a13433336d504 /drivers/char/hw_random | |
parent | 0c17b22c8c5aa1f71a30974066fea2d4b2511980 (diff) |
l2tp: fix use-after-free during module unload
commit 2f86953e7436c9b9a4690909c5e2db24799e173b upstream.
Tunnel deletion is delayed by both a workqueue (l2tp_tunnel_delete -> wq
-> l2tp_tunnel_del_work) and RCU (sk_destruct -> RCU ->
l2tp_tunnel_destruct).
By the time l2tp_tunnel_destruct() runs to destroy the tunnel and finish
destroying the socket, the private data reserved via the net_generic
mechanism has already been freed, but l2tp_tunnel_destruct() actually
uses this data.
Make sure tunnel deletion for the netns has completed before returning
from l2tp_exit_net() by first flushing the tunnel removal workqueue, and
then waiting for RCU callbacks to complete.
Fixes: 167eb17e0b17 ("l2tp: create tunnel sockets in the right namespace")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/hw_random')
0 files changed, 0 insertions, 0 deletions