From: libusb T. <tr...@li...> - 2011-01-18 04:07:27
|
#88: [PATCH] Crash cancelling transfer of disconnected device --------------------------------------------------------------------------------------+ Reporter: www.google.com/accounts/o8/id?id=aitoawmz93igogrpknbehv21jdxrf37ft8ksncg | Owner: Type: defect | Status: new Component: libusb-1.0 | Keywords: Blocks: | Blocked By: --------------------------------------------------------------------------------------+ Reproduced this on OSX. Haven't tried yet on Linux. I set up and submit a control transfer, but in the middle I disconnect the device. It crashes (with signal EXC_BAD_ACCESS) on line 1307 (in cancel_control_transfer of darwin_usb.c): {{{ kresult = (*(dpriv->device))->USBDeviceAbortPipeZero (dpriv->device); }}} I think it's a race condition where dpriv->device is made NULL by whatever code detects that the device has disconnected. A simple patch for this particular code path is: {{{ if (!dpriv->device) return LIBUSB_ERROR_NO_DEVICE; kresult = (*(dpriv->device))->USBDeviceAbortPipeZero (dpriv->device); }}} There may be a more generic code path available (& more code paths where this needs to be done). -- Ticket URL: <http://libusb.org/ticket/88> libusb <http://libusb.org/> C library for writing portable USB drivers in userspace |