Skip to contentSkip to conversation

net: dsa: bcm_sf2: Fix driver removal

PATCH Applied Florian Fainelli 3 participants 3 messages Nov 3, 2019 – Nov 6, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: bcm_sf2: Fix driver removal

With the DSA core doing the call to dsa_port_disable() we do not need to do that within the driver itself. This could cause an use after free since past dsa_unregister_switch() we should not be accessing any dsa_switch internal structures.

Fixes 0394a63acfe2 ("net: dsa: enable and disable all ports")
---
 drivers/net/dsa/bcm_sf2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/bcm_sf2.c +2 -2
index a4a46f8df352..79748ca30c33 100644
@@ -1212,10 +1212,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
 	struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
 
 	priv->wol_ports_mask = 0;
+	/* Disable interrupts */
+	bcm_sf2_intr_disable(priv);
 	dsa_unregister_switch(priv->dev->ds);
 	bcm_sf2_cfp_exit(priv->dev->ds);
-	/* Disable all ports and interrupts */
-	bcm_sf2_sw_suspend(priv->dev->ds);
 	bcm_sf2_mdio_unregister(priv);
 
 	return 0;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Florian Fainelli

With the DSA core doing the call to dsa_port_disable() we do not need to do that within the driver itself. This could cause an use after free since past dsa_unregister_switch() we should not be accessing any dsa_switch internal structures.

Fixes 0394a63acfe2 ("net: dsa: enable and disable all ports")
maintainer Applied
#2 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Sat, 2 Nov 2019 20:17:39 -0700

Quoted 7 lines

With the DSA core doing the call to dsa_port_disable() we do not need to do that within the driver itself. This could cause an use after free since past dsa_unregister_switch() we should not be accessing any dsa_switch internal structures.

Fixes 0394a63acfe2 ("net: dsa: enable and disable all ports")

Applied.