From 651be3a2ba95bc30fcb737985741736e63231cdf Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sat, 2 Feb 2008 23:15:02 +0200 Subject: [PATCH] net/phy/fixed.c: fix a use-after-free This patch fixes a use-after-free introduced by commit a79d8e93d300adb84cccc38ac396cfb118c238ad and spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Jeff Garzik --- drivers/net/phy/fixed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 73b6d39ef6b0..ca9b040f9ad9 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -236,12 +236,12 @@ module_init(fixed_mdio_bus_init); static void __exit fixed_mdio_bus_exit(void) { struct fixed_mdio_bus *fmb = &platform_fmb; - struct fixed_phy *fp; + struct fixed_phy *fp, *tmp; mdiobus_unregister(&fmb->mii_bus); platform_device_unregister(pdev); - list_for_each_entry(fp, &fmb->phys, node) { + list_for_each_entry_safe(fp, tmp, &fmb->phys, node) { list_del(&fp->node); kfree(fp); } -- 2.20.1