diff options
author | ru <ru@FreeBSD.org> | 2005-09-16 11:11:51 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-09-16 11:11:51 +0000 |
commit | d2f7ab28daf6bc7f93eb290728f89c7d713ca0ce (patch) | |
tree | eea8401041be885ba31c07333f6e0206b9d04ab0 /sys/pci/if_ste.c | |
parent | 02dbbd7982679f0c66e9ffa29caf799b5c1a3bde (diff) | |
download | FreeBSD-src-d2f7ab28daf6bc7f93eb290728f89c7d713ca0ce.zip FreeBSD-src-d2f7ab28daf6bc7f93eb290728f89c7d713ca0ce.tar.gz |
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.
Diffstat (limited to 'sys/pci/if_ste.c')
-rw-r--r-- | sys/pci/if_ste.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 4167951..eca7e11 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -1127,7 +1127,6 @@ ste_attach(dev) if (error) { device_printf(dev, "couldn't set up irq\n"); ether_ifdetach(ifp); - if_free(ifp); goto fail; } @@ -1163,8 +1162,9 @@ ste_detach(dev) STE_UNLOCK(sc); callout_drain(&sc->ste_stat_callout); ether_ifdetach(ifp); - if_free(ifp); } + if (ifp) + if_free(ifp); if (sc->ste_miibus) device_delete_child(dev, sc->ste_miibus); bus_generic_detach(dev); |