netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sfp: fix unbind
@ 2019-12-03 23:51 Russell King
  2019-12-05  0:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Russell King @ 2019-12-03 23:51 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev

When unbinding, we don't correctly tear down the module state, leaving
(for example) the hwmon registration behind. Ensure everything is
properly removed by sending a remove event at unbind.

Fixes: 6b0da5c9c1a3 ("net: sfp: track upstream's attachment state in state machine")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 8d05e888d3f8..78f53da1e34e 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2294,6 +2294,10 @@ static int sfp_remove(struct platform_device *pdev)
 
 	sfp_unregister_socket(sfp->sfp_bus);
 
+	rtnl_lock();
+	sfp_sm_event(sfp, SFP_E_REMOVE);
+	rtnl_unlock();
+
 	return 0;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: sfp: fix unbind
  2019-12-03 23:51 [PATCH net] net: sfp: fix unbind Russell King
@ 2019-12-05  0:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-12-05  0:58 UTC (permalink / raw)
  To: rmk+kernel; +Cc: andrew, f.fainelli, hkallweit1, netdev

From: Russell King <rmk+kernel@armlinux.org.uk>
Date: Tue, 03 Dec 2019 23:51:22 +0000

> When unbinding, we don't correctly tear down the module state, leaving
> (for example) the hwmon registration behind. Ensure everything is
> properly removed by sending a remove event at unbind.
> 
> Fixes: 6b0da5c9c1a3 ("net: sfp: track upstream's attachment state in state machine")
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-05  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 23:51 [PATCH net] net: sfp: fix unbind Russell King
2019-12-05  0:58 ` 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).