Pete Batard 737ba04ea4 Linux: Fix #81 URB double free race condition on device disconnect
A submitted transfer that has just been failed by the kernel could be
picked up by an event handler to be cleaned up, where freeing of URB
memory would race with the submit function doing it's own cleanup and
freeing as a result of the submit failing.

libusb_submit_transfer() always holds itransfer->lock, so the race can
be avoided by taking that lock also in the cleanup path and checking
that the URB memory has not already been freed before freeing it there.

As http://libusb.org/ticket/81#comment:14 notes there is still another
possible, but unlikely, race condition between libusb_submit_transfer()
and an event handling thread. That will require more work to solve.

[stuge: Add check in cleanup path that URBs have not already been freed]
2011-10-17 16:25:50 +02:00
2009-02-16 21:40:45 -03:00
2007-12-02 22:54:59 +00:00
2007-12-02 22:54:59 +00:00
2010-11-26 20:47:23 +01:00
2009-08-27 21:40:57 +05:45
2010-05-04 19:01:59 -03:00
2008-06-15 15:30:02 -05:00

libusb
======

libusb is a library for USB device access from Linux, Mac OS X and
Windows userspace.
It is written in C and licensed under the LGPL-2.1 (see COPYING).

libusb is abstracted internally in such a way that it can hopefully
be ported to other operating systems. See the PORTING file for some
information, if you fancy a challenge :)

libusb homepage:
http://libusb.org/

Developers will wish to consult the API documentation:
http://libusb.sourceforge.net/api-1.0/

Use the mailing list for questions, comments, etc:
https://sourceforge.net/mailarchive/forum.php?forum_name=libusb-devel

- Daniel Drake <dsd@gentoo.org>
- Peter Stuge <peter@stuge.se>
(use the mailing list rather than mailing developers directly)
S
Description
A cross-platform library to access USB devices
Readme 4 MiB
Languages
C 91.7%
C++ 3.1%
CMake 1.6%
Batchfile 1.1%
Makefile 1%
Other 1.5%