diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-02-03 20:59:06 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-02-03 20:59:06 +0000 |
commit | 392b40f235e8e72d79e6371613e0540747acf82e (patch) | |
tree | 31e77da3c1f31915b13cd0a62dbb41e6be963593 /sys/dev/usb | |
parent | 1e1d8220b120f0624dfd55723532676ad6d4dbe7 (diff) |
Check if the device is being detached when returning from tsleep() and
in such case do not try to cleanup the device since this would make the
thread sleep again while keeping a reference to the softc.
Fix a panic found by sebastia@, ok pirofti@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ucom.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 3e138808e8a..6e29bf3a121 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.62 2013/11/15 08:25:31 pirofti Exp $ */ +/* $OpenBSD: ucom.c,v 1.63 2014/02/03 20:59:05 mpi Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -491,6 +491,12 @@ ucom_do_open(dev_t dev, int flag, int mode, struct proc *p) SET(tp->t_state, TS_WOPEN); error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH, ttopen, 0); + + if (usbd_is_dying(sc->sc_uparent)) { + splx(s); + return (EIO); + } + /* * If TS_WOPEN has been reset, that means the * cua device has been closed. We don't want |