svn commit: r329904 - head/sys/dev/usb/net
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Feb 24 08:44:52 UTC 2018
Author: hselasky
Date: Sat Feb 24 08:44:51 2018
New Revision: 329904
URL: https://svnweb.freebsd.org/changeset/base/329904
Log:
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
Modified:
head/sys/dev/usb/net/if_axge.c
Modified: head/sys/dev/usb/net/if_axge.c
==============================================================================
--- head/sys/dev/usb/net/if_axge.c Sat Feb 24 04:02:06 2018 (r329903)
+++ head/sys/dev/usb/net/if_axge.c Sat Feb 24 08:44:51 2018 (r329904)
@@ -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;
/*
More information about the svn-src-all
mailing list