Skip to content

Commit

Permalink
vlan: unlink the upper neighbour before unregistering
Browse files Browse the repository at this point in the history
On netdev unregister we're removing also all of its sysfs-associated stuff,
including the sysfs symlinks that are controlled by netdev neighbour code.
Also, it's a subtle race condition - cause we can still access it after
unregistering.

Move the unlinking right before the unregistering to fix both.

CC: Patrick McHardy <kaber@trash.net>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Veaceslav Falico authored and David S. Miller committed Sep 26, 2013
1 parent 5df27e6 commit 47701a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)
vlan_gvrp_request_leave(dev);

vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, NULL);

netdev_upper_dev_unlink(real_dev, dev);
/* Because unregister_netdevice_queue() makes sure at least one rcu
* grace period is respected before device freeing,
* we dont need to call synchronize_net() here.
*/
unregister_netdevice_queue(dev, head);

netdev_upper_dev_unlink(real_dev, dev);

if (grp->nr_vlan_devs == 0) {
vlan_mvrp_uninit_applicant(real_dev);
vlan_gvrp_uninit_applicant(real_dev);
Expand Down

0 comments on commit 47701a3

Please sign in to comment.