* [PATCH net] net: dsa: Unregister slave_dev in error path
@ 2016-02-18 2:19 Florian Fainelli
2016-02-18 2:28 ` Florian Fainelli
2016-02-18 2:43 ` [PATCH net v2] " Florian Fainelli
0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2016-02-18 2:19 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, opendmb, Florian Fainelli
With commit 0071f56e46da ("dsa: Register netdev before phy"), we are now trying
to unregister 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>
---
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;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: Unregister slave_dev in error path
2016-02-18 2:19 [PATCH net] net: dsa: Unregister slave_dev in error path Florian Fainelli
@ 2016-02-18 2:28 ` Florian Fainelli
2016-02-18 2:43 ` [PATCH net v2] " Florian Fainelli
1 sibling, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2016-02-18 2:28 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, opendmb
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@gmail.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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net v2] net: dsa: Unregister slave_dev in error path
2016-02-18 2:19 [PATCH net] net: dsa: Unregister slave_dev in error path Florian Fainelli
2016-02-18 2:28 ` Florian Fainelli
@ 2016-02-18 2:43 ` Florian Fainelli
2016-02-18 3:05 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2016-02-18 2:43 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, opendmb, Florian Fainelli
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>
---
Changes in v2:
- fixed commit message to accurately reflect what we are doing s/unregister/free
net/dsa/slave.c | 1 +
1 file changed, 1 insertion(+)
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;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] net: dsa: Unregister slave_dev in error path
2016-02-18 2:43 ` [PATCH net v2] " Florian Fainelli
@ 2016-02-18 3:05 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-02-18 3:05 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, opendmb
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 17 Feb 2016 18:43:22 -0800
> 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>
Applied, thanks Florian.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-18 3:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 2:19 [PATCH net] net: dsa: Unregister slave_dev in error path Florian Fainelli
2016-02-18 2:28 ` Florian Fainelli
2016-02-18 2:43 ` [PATCH net v2] " Florian Fainelli
2016-02-18 3:05 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).