diff options
author | Ruslan Ermilov <ru@FreeBSD.org> | 2005-09-16 11:11:51 +0000 |
---|---|---|
committer | Ruslan Ermilov <ru@FreeBSD.org> | 2005-09-16 11:11:51 +0000 |
commit | 3badacee8c62f420e7519685b3700d5741d67ded (patch) | |
tree | eea8401041be885ba31c07333f6e0206b9d04ab0 /sys/dev/sf | |
parent | c4c6f08f6878d257f78ac12816d7f64b211f8f64 (diff) | |
download | src-3badacee8c62f420e7519685b3700d5741d67ded.tar.gz src-3badacee8c62f420e7519685b3700d5741d67ded.zip |
Fix "struct ifnet" leaks when attach() fails in the middle, e.g.
when mii_phy_probe() or bus_setup_intr() fails. For drivers that
call their detach() in this case, call if_free() there to cover
this case too.
Notes
Notes:
svn path=/head/; revision=150213
Diffstat (limited to 'sys/dev/sf')
-rw-r--r-- | sys/dev/sf/if_sf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index e14ce264d120..fa7eb83a71cc 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -766,7 +766,6 @@ sf_attach(dev) if (error) { device_printf(dev, "couldn't set up irq\n"); ether_ifdetach(ifp); - if_free(ifp); goto fail; } @@ -802,8 +801,9 @@ sf_detach(dev) SF_UNLOCK(sc); callout_drain(&sc->sf_stat_callout); ether_ifdetach(ifp); - if_free(ifp); } + if (ifp) + if_free(ifp); if (sc->sf_miibus) device_delete_child(dev, sc->sf_miibus); bus_generic_detach(dev); |