diff mbox series

[net] net: sfp: fix unbind

Message ID E1icHww-00043d-U9@rmk-PC.armlinux.org.uk
State Accepted
Delegated to: David Miller
Headers show
Series [net] net: sfp: fix unbind | expand

Commit Message

Russell King (Oracle) Dec. 3, 2019, 11:51 p.m. UTC
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(+)

Comments

David Miller Dec. 5, 2019, 12:58 a.m. UTC | #1
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.
diff mbox series

Patch

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;
 }