Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167301036
D23430.id67515.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23430.id67515.diff
View Options
Index: lib/libusb/libusb10_hotplug.c
===================================================================
--- lib/libusb/libusb10_hotplug.c
+++ lib/libusb/libusb10_hotplug.c
@@ -123,8 +123,10 @@
TAILQ_INIT(&hotplug_devs);
if (ctx->hotplug_handler != NO_THREAD) {
- if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
+ if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0) {
+ HOTPLUG_UNLOCK(ctx);
continue;
+ }
} else {
do_loop = 0;
}
@@ -132,15 +134,19 @@
/* figure out which devices are gone */
TAILQ_FOREACH_SAFE(adev, &ctx->hotplug_devs, hotplug_entry, temp) {
TAILQ_FOREACH(bdev, &hotplug_devs, hotplug_entry) {
- if (libusb_hotplug_equal(adev, bdev))
+ if (libusb_hotplug_equal(adev, bdev)) {
+ HOTPLUG_UNLOCK(ctx);
break;
+ }
}
if (bdev == NULL) {
TAILQ_REMOVE(&ctx->hotplug_devs, adev, hotplug_entry);
TAILQ_FOREACH_SAFE(acbh, &ctx->hotplug_cbh, entry, bcbh) {
if (libusb_hotplug_filter(ctx, acbh, adev,
- LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) == 0)
+ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) == 0) {
+ HOTPLUG_UNLOCK(ctx);
continue;
+ }
TAILQ_REMOVE(&ctx->hotplug_cbh, acbh, entry);
free(acbh);
}
@@ -151,16 +157,20 @@
/* figure out which devices are new */
TAILQ_FOREACH_SAFE(adev, &hotplug_devs, hotplug_entry, temp) {
TAILQ_FOREACH(bdev, &ctx->hotplug_devs, hotplug_entry) {
- if (libusb_hotplug_equal(adev, bdev))
+ if (libusb_hotplug_equal(adev, bdev)) {
+ HOTPLUG_UNLOCK(ctx);
break;
+ }
}
if (bdev == NULL) {
TAILQ_REMOVE(&hotplug_devs, adev, hotplug_entry);
TAILQ_INSERT_TAIL(&ctx->hotplug_devs, adev, hotplug_entry);
TAILQ_FOREACH_SAFE(acbh, &ctx->hotplug_cbh, entry, bcbh) {
if (libusb_hotplug_filter(ctx, acbh, adev,
- LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) == 0)
+ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) == 0) {
+ HOTPLUG_UNLOCK(ctx);
continue;
+ }
TAILQ_REMOVE(&ctx->hotplug_cbh, acbh, entry);
free(acbh);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 21, 7:02 PM (10 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37047203
Default Alt Text
D23430.id67515.diff (2 KB)
Attached To
Mode
D23430: libusb: libusb10_hotplug: Remove lock leaks, locked sleep
Attached
Detach File
Event Timeline
Log In to Comment