svn commit: r243648 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Wed Nov 28 07:12:09 UTC 2012
Author: adrian
Date: Wed Nov 28 07:12:08 2012
New Revision: 243648
URL: http://svnweb.freebsd.org/changeset/base/243648
Log:
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.
Modified:
head/sys/dev/ath/if_ath.c
Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c Wed Nov 28 06:55:34 2012 (r243647)
+++ head/sys/dev/ath/if_ath.c Wed Nov 28 07:12:08 2012 (r243648)
@@ -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;
}
More information about the svn-src-all
mailing list