summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-11-28 07:12:08 +0000
committeradrian <adrian@FreeBSD.org>2012-11-28 07:12:08 +0000
commit9817eedd68000f200c41e5974d6d016a3aa9e72d (patch)
tree03cdf3233de3d12e1da597d44f53b5284c28644d /sys/dev
parent4e2c29a3467070580f73ca8802b0764e0e211983 (diff)
downloadFreeBSD-src-9817eedd68000f200c41e5974d6d016a3aa9e72d.zip
FreeBSD-src-9817eedd68000f200c41e5974d6d016a3aa9e72d.tar.gz
Call if_free() with the correct vnet context if and only if ifp_vnet
isn't NULL. If the attach fails prematurely and there's no if_vnet context, calling CURVNET_SET(ifp->if_vnet) is going to dereference a NULL pointer.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ath/if_ath.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 2d74e3e..18fffaa 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -918,11 +918,16 @@ bad2:
bad:
if (ah)
ath_hal_detach(ah);
- if (ifp != NULL) {
+
+ /*
+ * To work around scoping issues with CURVNET_SET/CURVNET_RESTORE..
+ */
+ if (ifp != NULL && ifp->if_vnet) {
CURVNET_SET(ifp->if_vnet);
if_free(ifp);
CURVNET_RESTORE();
- }
+ } else if (ifp != NULL)
+ if_free(ifp);
sc->sc_invalid = 1;
return error;
}
OpenPOWER on IntegriCloud