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.
This commit is contained in:
parent
491e124856
commit
8bf4020830
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243648
@ -918,11 +918,16 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user