summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/usb_dev.c')
-rw-r--r--sys/dev/usb/usb_dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index cba8919..b7c6553 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -1040,9 +1040,14 @@ usb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, struct thread*
* Performance optimisation: We try to check for IOCTL's that
* don't need the USB reference first. Then we grab the USB
* reference if we need it!
+ * Note that some ioctl_post handlers would need to run with the
+ * newbus lock held. It cannot be acquired later because it can
+ * introduce a LOR, so acquire it here.
*/
+ newbus_xlock();
err = usb_ref_device(cpd, &refs, 0 /* no uref */ );
if (err) {
+ newbus_xunlock();
return (ENXIO);
}
fflags = cpd->fflags;
@@ -1076,6 +1081,7 @@ usb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, struct thread*
}
done:
usb_unref_device(cpd, &refs);
+ newbus_xunlock();
return (err);
}
OpenPOWER on IntegriCloud