Skip to content

Commit e86a9e6

Browse files
venkatxvenkatsubraBrian Maly
authored andcommitted
vxlan: fix use-after-free on deletion (part 2)
After commit 15a48cc (vxlan: fix use-after-free on deletion) vxlan_dellink doesn't need to take out the vxlan_dev from the hlist. Because, that is done in vxlan_vs_del_dev now. Having it at both the places results in system crash sometimes with the following stack trace general protection fault: 0000 [#1] SMP ... vxlan_sock_release+0x6a/0xd0 [vxlan] Call Trace: vxlan_stop+0xee/0x310 [vxlan] __dev_close_many+0xa8/0x110 dev_close_many+0x98/0x140 rollback_registered_many+0x10d/0x310 unregister_netdevice_many+0x19/0x60 default_device_exit_batch+0x164/0x190 ? abort_exclusive_wait+0xb0/0xb0 ops_exit_list.isra.4+0x59/0x70 cleanup_net+0x1f0/0x380 process_one_work+0x165/0x470 worker_thread+0x112/0x540 ? rescuer_thread+0x3f0/0x3f0 kthread+0xda/0xf0 It crashes here: static void vxlan_vs_del_dev(struct vxlan_dev *vxlan) { struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); spin_lock(&vn->sock_lock); hlist_del_init_rcu(&vxlan->hlist); <--- here spin_unlock(&vn->sock_lock); } Orabug: 29927196 Reviewed-by: Rama Nichanamatlu <[email protected]> Signed-off-by: Venkat Venkatsubra <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 2da8c7a commit e86a9e6

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

drivers/net/vxlan.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,12 +2874,6 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
28742874
static void vxlan_dellink(struct net_device *dev, struct list_head *head)
28752875
{
28762876
struct vxlan_dev *vxlan = netdev_priv(dev);
2877-
struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
2878-
2879-
spin_lock(&vn->sock_lock);
2880-
if (!hlist_unhashed(&vxlan->hlist))
2881-
hlist_del_rcu(&vxlan->hlist);
2882-
spin_unlock(&vn->sock_lock);
28832877

28842878
gro_cells_destroy(&vxlan->gro_cells);
28852879
list_del(&vxlan->next);

0 commit comments

Comments
 (0)