aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2008-02-02 16:15:02 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:15:36 -0500
commit651be3a2ba95bc30fcb737985741736e63231cdf (patch)
treea2804052769372d456384660a94dfcbb5418cf32
parentd785ad74641c59074786084b24a9283d7a7727b0 (diff)
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 <bunk@kernel.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/phy/fixed.c4
1 files 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);
236static void __exit fixed_mdio_bus_exit(void) 236static void __exit fixed_mdio_bus_exit(void)
237{ 237{
238 struct fixed_mdio_bus *fmb = &platform_fmb; 238 struct fixed_mdio_bus *fmb = &platform_fmb;
239 struct fixed_phy *fp; 239 struct fixed_phy *fp, *tmp;
240 240
241 mdiobus_unregister(&fmb->mii_bus); 241 mdiobus_unregister(&fmb->mii_bus);
242 platform_device_unregister(pdev); 242 platform_device_unregister(pdev);
243 243
244 list_for_each_entry(fp, &fmb->phys, node) { 244 list_for_each_entry_safe(fp, tmp, &fmb->phys, node) {
245 list_del(&fp->node); 245 list_del(&fp->node);
246 kfree(fp); 246 kfree(fp);
247 } 247 }