Commit 5df27e6c authored by Veaceslav Falico's avatar Veaceslav Falico Committed by David S. Miller

vlan: link the upper neighbour only after registering

Otherwise users might access it without being fully registered, as per
sysfs - it only inits in register_netdevice(), so is unusable till it is
called.

CC: Patrick McHardy <kaber@trash.net>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4fee991a
...@@ -169,13 +169,13 @@ int register_vlan_dev(struct net_device *dev) ...@@ -169,13 +169,13 @@ int register_vlan_dev(struct net_device *dev)
if (err < 0) if (err < 0)
goto out_uninit_mvrp; goto out_uninit_mvrp;
err = netdev_upper_dev_link(real_dev, dev);
if (err)
goto out_uninit_mvrp;
err = register_netdevice(dev); err = register_netdevice(dev);
if (err < 0) if (err < 0)
goto out_upper_dev_unlink; goto out_uninit_mvrp;
err = netdev_upper_dev_link(real_dev, dev);
if (err)
goto out_unregister_netdev;
/* Account for reference in struct vlan_dev_priv */ /* Account for reference in struct vlan_dev_priv */
dev_hold(real_dev); dev_hold(real_dev);
...@@ -191,8 +191,8 @@ int register_vlan_dev(struct net_device *dev) ...@@ -191,8 +191,8 @@ int register_vlan_dev(struct net_device *dev)
return 0; return 0;
out_upper_dev_unlink: out_unregister_netdev:
netdev_upper_dev_unlink(real_dev, dev); unregister_netdevice(dev);
out_uninit_mvrp: out_uninit_mvrp:
if (grp->nr_vlan_devs == 0) if (grp->nr_vlan_devs == 0)
vlan_mvrp_uninit_applicant(real_dev); vlan_mvrp_uninit_applicant(real_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment