[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56C52C46.6070203@gmail.com>
Date: Wed, 17 Feb 2016 18:28:22 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, andrew@...n.ch, opendmb@...il.com
Subject: Re: [PATCH net] net: dsa: Unregister slave_dev in error path
Le 17/02/2016 18:19, Florian Fainelli a écrit :
> With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
> to unregister
s/unregister/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@...il.com>
> ---
> 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 40b9ca7..e685042 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1205,6 +1205,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;
> }
>
--
Florian
Powered by blists - more mailing lists