Fix race when detach is called right after attach in if_axge, that the

network device pointer might be NULL. Wait for any pending tasks to
complete before calling axge_stop().

MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2018-02-24 08:44:51 +00:00
parent eed91cae68
commit 7ef4e76f74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329904

View File

@ -587,6 +587,10 @@ axge_detach(device_t dev)
sc = device_get_softc(dev);
ue = &sc->sc_ue;
if (device_is_attached(dev)) {
/* wait for any post attach or other command to complete */
usb_proc_drain(&ue->ue_tq);
AXGE_LOCK(sc);
/*
* XXX
@ -878,7 +882,8 @@ axge_stop(struct usb_ether *ue)
val &= ~MSR_RE;
axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_MSR, val);
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
if (ifp != NULL)
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
sc->sc_flags &= ~AXGE_FLAG_LINK;
/*