diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2016-02-17 18:43:22 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-17 22:05:16 -0500 |
commit | 73dcb556538a4192222c3a919a51e1701bae553b (patch) | |
tree | 00d6bc3876542be3b76ef7d9fd0c0042515ffacb /net | |
parent | 79be1a1c9090048f6f327204b8b1cf4ac067b487 (diff) | |
download | linux-stable-73dcb556538a4192222c3a919a51e1701bae553b.tar.gz linux-stable-73dcb556538a4192222c3a919a51e1701bae553b.tar.bz2 linux-stable-73dcb556538a4192222c3a919a51e1701bae553b.zip |
net: dsa: Unregister slave_dev in error path
With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
to free a network device that has been previously registered, and in case of
errors, this will make us hit the BUG_ON(dev->reg_state != NETREG_UNREGISTERED)
condition.
Fix this by adding a missing unregister_netdev() before free_netdev().
Fixes: 0071f56e46da ("dsa: Register netdev before phy")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dsa/slave.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 91e3b2ff364a..ab24521beb4d 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1204,6 +1204,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent, ret = dsa_slave_phy_setup(p, slave_dev); if (ret) { netdev_err(master, "error %d setting up slave phy\n", ret); + unregister_netdev(slave_dev); free_netdev(slave_dev); return ret; } |