lkml.org 
[lkml]   [2021]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 141/177] net: mdio: thunder: Fix a double free issue in the .remove function
    Date
    From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

    [ 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/phy/mdio-thunder.c | 1 -
    1 file changed, 1 deletion(-)

    diff --git a/drivers/net/phy/mdio-thunder.c b/drivers/net/phy/mdio-thunder.c
    index b6128ae7f14f..1e2f57ed1ef7 100644
    --- a/drivers/net/phy/mdio-thunder.c
    +++ b/drivers/net/phy/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_set_drvdata(pdev, NULL);
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-05-31 17:46    [W:4.146 / U:0.232 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site