提交 e4334c83 编写于 作者: C Christophe JAILLET 提交者: Yang Yingliang

net: mdio: octeon: Fix some double free issues

[ Upstream commit e1d027dd ]

'bus->mii_bus' has 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 error handling path of the
probe function and in remove function.
Suggested-By: NAndrew Lunn <andrew@lunn.ch>
Fixes: 35d2aeac ("phy: mdio-octeon: Use devm_mdiobus_alloc_size()")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: NRussell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 244ccc8e
...@@ -75,7 +75,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev) ...@@ -75,7 +75,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev)
return 0; return 0;
fail_register: fail_register:
mdiobus_free(bus->mii_bus);
smi_en.u64 = 0; smi_en.u64 = 0;
oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
return err; return err;
...@@ -89,7 +88,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev) ...@@ -89,7 +88,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev)
bus = platform_get_drvdata(pdev); bus = platform_get_drvdata(pdev);
mdiobus_unregister(bus->mii_bus); mdiobus_unregister(bus->mii_bus);
mdiobus_free(bus->mii_bus);
smi_en.u64 = 0; smi_en.u64 = 0;
oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册