diff options
author | hselasky <hselasky@FreeBSD.org> | 2014-01-17 08:21:09 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2014-01-17 08:21:09 +0000 |
commit | 28503bcf6ed336c719818a38e84f28bc370703ee (patch) | |
tree | bddc3036ec65e4298272df51ecd85b3d4942ada0 /sys/dev/usb/usb_dev.c | |
parent | c46f73c7ae08f8eec4084f731b5c3c4c0fa42b19 (diff) | |
download | FreeBSD-src-28503bcf6ed336c719818a38e84f28bc370703ee.zip FreeBSD-src-28503bcf6ed336c719818a38e84f28bc370703ee.tar.gz |
Close a minor deadlock.
MFC after: 1 week
Diffstat (limited to 'sys/dev/usb/usb_dev.c')
-rw-r--r-- | sys/dev/usb/usb_dev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 9e3cef5..c5ee368 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -597,6 +597,13 @@ usb_fifo_free(struct usb_fifo *f) mtx_unlock(f->priv_mtx); mtx_lock(&usb_ref_lock); + /* + * Check if the "f->refcount" variable reached zero + * during the unlocked time before entering wait: + */ + if (f->refcount == 0) + break; + /* wait for sync */ cv_wait(&f->cv_drain, &usb_ref_lock); } |