]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: mdio: thunder: Fix a double free issue in the .remove function
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 13 May 2021 07:44:49 +0000 (09:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 07:00:47 +0000 (09:00 +0200)
[ Upstream commit a93a0a15876d2a077a3bc260b387d2457a051f24 ]

'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>
Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/mdio/mdio-thunder.c

index 3d7eda99d34e2f9178ab6085c00691778eb33a0f..dd7430c998a2a5db4ec9ee9730e693891d7fd50b 100644 (file)
@@ -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);