summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_transfer.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2016-09-12 10:14:30 +0000
committerhselasky <hselasky@FreeBSD.org>2016-09-12 10:14:30 +0000
commita1a22a6289df77ce21f083b6b8f3334eaeba390e (patch)
tree296e7778360b96185b83ef1a47f4015819c4598d /sys/dev/usb/usb_transfer.c
parent860932ee33fe82330891c9acc939827c05f20999 (diff)
downloadFreeBSD-src-a1a22a6289df77ce21f083b6b8f3334eaeba390e.zip
FreeBSD-src-a1a22a6289df77ce21f083b6b8f3334eaeba390e.tar.gz
MFC r305421:
Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@
Diffstat (limited to 'sys/dev/usb/usb_transfer.c')
-rw-r--r--sys/dev/usb/usb_transfer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index 3c920f9..a2ca28b 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -953,7 +953,7 @@ usbd_transfer_setup(struct usb_device *udev,
return (error);
/* Protect scratch area */
- do_unlock = usbd_enum_lock(udev);
+ do_unlock = usbd_ctrl_lock(udev);
refcount = 0;
info = NULL;
@@ -1274,7 +1274,7 @@ done:
error = parm->err;
if (do_unlock)
- usbd_enum_unlock(udev);
+ usbd_ctrl_unlock(udev);
return (error);
}
OpenPOWER on IntegriCloud