From e3242f9d08083a21f71103b918ba2327dba6236d Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Fri, 31 May 2013 04:45:59 +0000 Subject: [PATCH] Make netif_free() safe to call on a partially initialized softc. Sponsored by: Spectra Logic Corporation MFC after: 1 week --- sys/dev/xen/netfront/netfront.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 6548c04aa590..6e3260d99e07 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -2177,8 +2177,11 @@ netif_free(struct netfront_info *info) callout_drain(&info->xn_stat_ch); netif_disconnect_backend(info); ifmedia_removeall(&info->sc_media); - ether_ifdetach(info->xn_ifp); - if_free(info->xn_ifp); + if (info->xn_ifp != NULL) { + ether_ifdetach(info->xn_ifp); + if_free(info->xn_ifp); + info->xn_ifp = NULL; + } } static void