linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: bcm_sf2: Fix driver removal
@ 2019-11-03  3:17 Florian Fainelli
  2019-11-03  4:01 ` Vivien Didelot
  2019-11-06  1:55 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2019-11-03  3:17 UTC (permalink / raw)
  To: netdev
  Cc: rmk+kernel, hkallweit1, Florian Fainelli, Andrew Lunn,
	Vivien Didelot, David S. Miller, open list

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")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/bcm_sf2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index a4a46f8df352..79748ca30c33 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -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;
-- 
2.17.1


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

* Re: [PATCH net] net: dsa: bcm_sf2: Fix driver removal
  2019-11-03  3:17 [PATCH net] net: dsa: bcm_sf2: Fix driver removal Florian Fainelli
@ 2019-11-03  4:01 ` Vivien Didelot
  2019-11-06  1:55 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Vivien Didelot @ 2019-11-03  4:01 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, rmk+kernel, hkallweit1, Florian Fainelli, Andrew Lunn,
	David S. Miller, open list

On Sat,  2 Nov 2019 20:17:39 -0700, Florian Fainelli <f.fainelli@gmail.com> wrote:
> 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")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>

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

* Re: [PATCH net] net: dsa: bcm_sf2: Fix driver removal
  2019-11-03  3:17 [PATCH net] net: dsa: bcm_sf2: Fix driver removal Florian Fainelli
  2019-11-03  4:01 ` Vivien Didelot
@ 2019-11-06  1:55 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-06  1:55 UTC (permalink / raw)
  To: f.fainelli
  Cc: netdev, rmk+kernel, hkallweit1, andrew, vivien.didelot, linux-kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat,  2 Nov 2019 20:17:39 -0700

> 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")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied.

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

end of thread, other threads:[~2019-11-06  1:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-03  3:17 [PATCH net] net: dsa: bcm_sf2: Fix driver removal Florian Fainelli
2019-11-03  4:01 ` Vivien Didelot
2019-11-06  1:55 ` 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).