netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove()
@ 2022-02-15 10:42 Alexey Khoroshilov
  2022-02-15 12:14 ` Andrew Lunn
  2022-02-17  5:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2022-02-15 10:42 UTC (permalink / raw)
  To: Vladimir Oltean, Florian Fainelli, Jakub Kicinski
  Cc: Alexey Khoroshilov, Hauke Mehrtens, Andrew Lunn, Vivien Didelot,
	David S. Miller, netdev, linux-kernel, ldv-project

of_node_put(priv->ds->slave_mii_bus->dev.of_node) should be
done before mdiobus_free(priv->ds->slave_mii_bus).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: 0d120dfb5d67 ("net: dsa: lantiq_gswip: don't use devres for mdiobus")
---
 drivers/net/dsa/lantiq_gswip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 320ee7fe91a8..8a7a8093a156 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -2176,8 +2176,8 @@ static int gswip_remove(struct platform_device *pdev)
 
 	if (priv->ds->slave_mii_bus) {
 		mdiobus_unregister(priv->ds->slave_mii_bus);
-		mdiobus_free(priv->ds->slave_mii_bus);
 		of_node_put(priv->ds->slave_mii_bus->dev.of_node);
+		mdiobus_free(priv->ds->slave_mii_bus);
 	}
 
 	for (i = 0; i < priv->num_gphy_fw; i++)
-- 
2.7.4


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

* Re: [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove()
  2022-02-15 10:42 [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove() Alexey Khoroshilov
@ 2022-02-15 12:14 ` Andrew Lunn
  2022-02-17  5:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-02-15 12:14 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Vladimir Oltean, Florian Fainelli, Jakub Kicinski,
	Hauke Mehrtens, Vivien Didelot, David S. Miller, netdev,
	linux-kernel, ldv-project

On Tue, Feb 15, 2022 at 01:42:48PM +0300, Alexey Khoroshilov wrote:
> of_node_put(priv->ds->slave_mii_bus->dev.of_node) should be
> done before mdiobus_free(priv->ds->slave_mii_bus).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: 0d120dfb5d67 ("net: dsa: lantiq_gswip: don't use devres for mdiobus")

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove()
  2022-02-15 10:42 [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove() Alexey Khoroshilov
  2022-02-15 12:14 ` Andrew Lunn
@ 2022-02-17  5:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-17  5:20 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: vladimir.oltean, f.fainelli, kuba, hauke, andrew, vivien.didelot,
	davem, netdev, linux-kernel, ldv-project

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Feb 2022 13:42:48 +0300 you wrote:
> of_node_put(priv->ds->slave_mii_bus->dev.of_node) should be
> done before mdiobus_free(priv->ds->slave_mii_bus).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: 0d120dfb5d67 ("net: dsa: lantiq_gswip: don't use devres for mdiobus")
> ---
>  drivers/net/dsa/lantiq_gswip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - net: dsa: lantiq_gswip: fix use after free in gswip_remove()
    https://git.kernel.org/netdev/net/c/8c6ae46150a4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-02-17  5:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 10:42 [PATCH] net: dsa: lantiq_gswip: fix use after free in gswip_remove() Alexey Khoroshilov
2022-02-15 12:14 ` Andrew Lunn
2022-02-17  5:20 ` patchwork-bot+netdevbpf

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).