linux: Take hotplug_lock for scan_devices, hotplug_enumerate and _disconnect
authorHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 14:21:23 +0000 (16:21 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 15:18:32 +0000 (17:18 +0200)
commit6270638991a56489128955699e37d5ca33f30f83
treee02d71bb50a57c688596ca774028258905f59053
parent50f79a1ada1df394dfeac4975e37b087a124e321
linux: Take hotplug_lock for scan_devices, hotplug_enumerate and _disconnect

As soon as we've started listening for hp events, hotplug_enumerate and
_disconnect can run, they do test then add / remove operations on the
device list. This can race with scan_devices adding devices, so take
the lock around all 3 to avoid the race.

Also fix the lock not being released in case of linux_start_event_monitor
failure.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/os/linux_usbfs.c
libusb/version_nano.h