linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mdio: Fix a double free issue in the .remove function
@ 2021-05-12 21:35 Christophe JAILLET
  2021-05-12 21:44 ` Russell King - ARM Linux admin
  2021-05-12 21:44 ` Andrew Lunn
  0 siblings, 2 replies; 7+ messages in thread
From: Christophe JAILLET @ 2021-05-12 21:35 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, kuba, david.daney
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

'bus->mii_bus' have been allocated with 'devm_mdiobus_alloc_size()' in the
probe function. So it must not be freed explicitly or there will be a
double free.

Remove the incorrect 'mdiobus_free' in the remove function.

Fixes: 379d7ac7ca31 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/mdio/mdio-thunder.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-thunder.c b/drivers/net/mdio/mdio-thunder.c
index cb1761693b69..822d2cdd2f35 100644
--- a/drivers/net/mdio/mdio-thunder.c
+++ b/drivers/net/mdio/mdio-thunder.c
@@ -126,7 +126,6 @@ static void thunder_mdiobus_pci_remove(struct pci_dev *pdev)
 			continue;
 
 		mdiobus_unregister(bus->mii_bus);
-		mdiobus_free(bus->mii_bus);
 		oct_mdio_writeq(0, bus->register_base + SMI_EN);
 	}
 	pci_release_regions(pdev);
-- 
2.30.2


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

end of thread, other threads:[~2021-05-13  8:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 21:35 [PATCH] net: mdio: Fix a double free issue in the .remove function Christophe JAILLET
2021-05-12 21:44 ` Russell King - ARM Linux admin
2021-05-13  6:29   ` Christophe JAILLET
2021-05-13  8:09     ` Russell King - ARM Linux admin
2021-05-13  8:22       ` Christophe JAILLET
2021-05-12 21:44 ` Andrew Lunn
2021-05-13  6:21   ` Christophe JAILLET

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