diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-12-18 10:44:18 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-12-18 10:44:18 +0000 |
commit | 70392a849d6c70b0013a0a715a6ccade9d7b5de3 (patch) | |
tree | a163298dfeba6cbdf2e43395a320005d96687f5f | |
parent | 1111f6fb3f939b0031aaba714a8b95cc5e471f1c (diff) |
If a host controller has been detached or reported a halt condition it
should be considered as dead. In such condition the stack no longer
submits I/O or schedules any USB task for its bus.
However we need an explore task to detach the root hub since only the
task thread is supposed to discover buses and attach/detach devices in
order to avoid races.
So reset the bus' dying flag when marking it as disconnecting in order
to let the task be scheduled. This should be safe because a detached
or halted HC should not trigger any new interrupt.
Fix a panic when detaching USB PCMCIA cards reported by Tilo Stritzky.
-rw-r--r-- | sys/dev/usb/usb.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index ef99af42c9e..ab8ce995603 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.102 2014/08/10 11:18:57 mpi Exp $ */ +/* $OpenBSD: usb.c,v 1.103 2014/12/18 10:44:17 mpi Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -262,6 +262,13 @@ usb_detach_roothub(struct usb_softc *sc) * it. */ sc->sc_bus->flags |= USB_BUS_DISCONNECTING; + /* + * Reset the dying flag in case it has been set by the interrupt + * handler when unplugging an HC card otherwise the task wont be + * scheduled. This is safe since a dead HC should not trigger + * new interrupt. + */ + sc->sc_bus->dying = 0; usb_needs_explore(sc->sc_bus->root_hub, 0); usb_wait_task(sc->sc_bus->root_hub, &sc->sc_explore_task); |