summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@openvpn.net>2026-03-17 14:47:56 +0100
committerAntonio Quartulli <antonio@openvpn.net>2026-05-14 16:24:45 +0200
commit982422b11e6f95f766a8cd2c2b1cbdb77e234a61 (patch)
treeb87695f129f8cc7a407d2e2cc4b129ec2160f3f3 /tools/testing
parent1fef6614673ff0846d30acdeeaf3cf98bb5f6116 (diff)
ovpn: fix race between deleting interface and adding new peer
While deleting an existing ovpn interface, there is a very narrow window where adding a new peer via netlink may cause the netdevice to hang and prevent its unregistration. It may happen during ovpn_dellink(), when all existing peers are freed and the device is queued for deregistration, but a CMD_PEER_NEW message comes in adding a new peer that takes again a reference to the netdev. At this point there is no way to release the device because we are under the assumption that all peers were already released. Fix the race condition by releasing all peers in ndo_uninit(), when the netdevice has already been removed from the netdev list. Also ovpn_peer_add() has now an extra check that forces the function to bail out if the device reg_state is not REGISTERED. This way any incoming CMD_PEER_NEW racing with the interface deletion routine will simply stop before adding the peer. Note that the above check happens while holding the netdev_lock to prevent racing netdev state changes. ovpn_dellink() is now empty and can be removed. Reported-by: Hyunwoo Kim <imv4bel@gmail.com> Closes: https://lore.kernel.org/netdev/aaVgJ16edTfQkYbx@v4bel/ Suggested-by: Sabrina Dubroca <sd@queasysnail.net> Fixes: 80747caef33d ("ovpn: introduce the ovpn_peer object") Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Diffstat (limited to 'tools/testing')
0 files changed, 0 insertions, 0 deletions