--- a/sys/bus/u4b/usb_hub.c +++ b/sys/bus/u4b/usb_hub.c @@ -1673,6 +1673,12 @@ sc = device_get_softc(parent); hub = sc->sc_udev->hub; + if (hub == NULL) { + /* racing uhub_detach(): the hub is gone */ + if (buflen) + buf[0] = 0; + return (0); + } uhub_find_iface_index(hub, child, &res); if (!res.udev) { @@ -1716,6 +1722,12 @@ sc = device_get_softc(parent); hub = sc->sc_udev->hub; + if (hub == NULL) { + /* racing uhub_detach(): the hub is gone */ + if (buflen) + buf[0] = 0; + return (0); + } uhub_find_iface_index(hub, child, &res); if (!res.udev) {