From: Veaceslav Falico Date: Wed, 25 Sep 2013 07:20:29 +0000 (+0200) Subject: vlan: link the upper neighbour only after registering X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5df27e6cb2d302e90366848bc3c2bb73c41287fb;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 CC: "David S. Miller" Signed-off-by: Veaceslav Falico Signed-off-by: David S. Miller --- diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 61fc573f1142..69b4a352021f 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -169,13 +169,13 @@ int register_vlan_dev(struct net_device *dev) if (err < 0) goto out_uninit_mvrp; - err = netdev_upper_dev_link(real_dev, dev); - if (err) - goto out_uninit_mvrp; - err = register_netdevice(dev); 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 */ dev_hold(real_dev); @@ -191,8 +191,8 @@ int register_vlan_dev(struct net_device *dev) return 0; -out_upper_dev_unlink: - netdev_upper_dev_unlink(real_dev, dev); +out_unregister_netdev: + unregister_netdevice(dev); out_uninit_mvrp: if (grp->nr_vlan_devs == 0) vlan_mvrp_uninit_applicant(real_dev);