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:
parent
5994d699a3
commit
adf0d49b1f
@ -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;
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user