Revised commits to rework libusb buffer management are available at:
https://github.com/pabigot/rtl-sdr/tree/fix-libusb-segv-r2
This is a refactored/rebased version of the content of
https://github.com/pabigot/rtl-sdr/tree/fix-libusb-segv, which has been
extended since first proposed. It reverts the 2014-02-17 workaround for
the problem along with more robust cancellation, and extends previous
proposed patch to handle cancellation because of libusb errors as well
as to external signals or application calls to rtlsdr_cancel_async.
I have tested this with rtl_sdr on Ubuntu-12.04 to ensure clean shutdown
due to keyboard interrupt and to removal of dongle, and using another
application which cancels the read within the program itself. The
patches eliminate segfaults that were observed under these conditions
with the unpatched sources.
Please evaluate fix-libusb-segv-r2 for a merge to master.
Peter
On 07/13/2014 05:18 AM, Peter A. Bigot wrote:
Please consider the attached patch, also available at
https://github.com/pabigot/rtl-sdr/tree/fix-libusb-segv. This reworks
the buffer management in rtlsdr_read_async to ensure that libusb has
no outstanding transactions related to transfer buffers prior to those
buffers being freed.
Peter