linux-stable/drivers/usb/core
Alan Stern bcf3985376 USB: don't clear urb->dev in scatter-gather library
This patch (as1517b) fixes an error in the USB scatter-gather library.
The library code uses urb->dev to determine whether or nor an URB is
currently active; the completion handler sets urb->dev to NULL.
However the core unlinking routines need to use urb->dev.  Since
unlinking always racing with completion, the completion handler must
not clear urb->dev -- it can lead to invalid memory accesses when a
transfer has to be cancelled.

This patch fixes the problem by getting rid of the lines that clear
urb->dev after urb has been submitted.  As a result we may end up
trying to unlink an URB that failed in submission or that has already
completed, so an extra check is added after each unlink to avoid
printing an error message when this happens.  The checks are updated
in both sg_complete() and sg_cancel(), and the second is updated to
match the first (currently it prints out unnecessary warning messages
if a device is unplugged while a transfer is in progress).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Illia Zaitsev <I.Zaitsev@adbglobal.com>
CC: Ming Lei <tom.leiming@gmail.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-06 13:54:00 -07:00
..
buffer.c USB: Core: Fix minor coding style issues 2011-01-22 19:35:39 -08:00
config.c usbcore: get BOS descriptor set 2011-09-26 15:51:08 -07:00
devices.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
devio.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
driver.c USB merge for 3.4-rc1 2012-03-20 11:26:30 -07:00
endpoint.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
file.c switch device_get_devnode() and ->devnode() to umode_t * 2012-01-03 22:54:55 -05:00
generic.c USB: accept RNDIS configs if there's no alternative 2010-08-10 14:35:43 -07:00
hcd-pci.c usb: fix defined but not used warnings in hcd-pci.c 2012-02-28 10:53:08 -08:00
hcd.c usb: core: hcd: make hcd->irq unsigned 2012-03-01 09:31:22 -08:00
hub.c USB: dynamically allocate usb_device children pointers instead of using a fix array 2012-03-13 14:24:07 -07:00
inode.c usbfs: kill racy detection of simple_pin_fs() 2012-03-20 21:29:45 -04:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile usb: makefile cleanup 2010-10-22 10:22:07 -07:00
message.c USB: don't clear urb->dev in scatter-gather library 2012-04-06 13:54:00 -07:00
notify.c usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
otg_whitelist.h
quirks.c USB: add quirk for another camera 2012-01-03 16:48:56 -08:00
sysfs.c usb: Add support for indicating whether a port is removable 2012-02-09 08:40:11 -08:00
urb.c usb/core: remove "always" from usb_unlink_urb() kernel doc entry 2012-03-02 16:22:11 -08:00
usb.c USB: cleanup the handling of the PM complete call 2012-01-24 14:23:49 -08:00
usb.h USB: cleanup the handling of the PM complete call 2012-01-24 14:23:49 -08:00