linux/drivers/usb/core
Matthew Wilcox b214f191d9 USB: Fix unplug of device with active streams
If I unplug a device while the UAS driver is loaded, I get an oops
in usb_free_streams().  This is because usb_unbind_interface() calls
usb_disable_interface() which calls usb_disable_endpoint() which sets
ep_out and ep_in to NULL.  Then the UAS driver calls usb_pipe_endpoint()
which returns a NULL pointer and passes an array of NULL pointers to
usb_free_streams().

I think the correct fix for this is to check for the NULL pointer
in usb_free_streams() rather than making the driver check for this
situation.  My original patch for this checked for dev->state ==
USB_STATE_NOTATTACHED, but the call to usb_disable_interface() is
conditional, so not all drivers would want this check.

Note from Sarah Sharp: This patch does avoid a potential dereference,
but the real fix (which will be implemented later) is to set the
.soft_unbind flag in the usb_driver structure for the UAS driver, and
all drivers that allocate streams.  The driver should free any streams
when it is unbound from the interface.  This avoids leaking stream rings
in the xHCI driver when usb_disable_interface() is called.

This should be queued for stable trees back to 2.6.35.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
2011-04-13 16:57:33 -07:00
..
buffer.c USB: Core: Fix minor coding style issues 2011-01-22 19:35:39 -08:00
config.c USB: remove the usb_host_ss_ep_comp structure 2010-05-20 13:21:40 -07:00
devices.c USB: fix formatting of SuperSpeed endpoints in /proc/bus/usb/devices 2011-04-13 16:13:46 -07:00
devio.c USB: Do not pass negative length to snoop_urb() 2011-03-23 13:14:16 -07:00
driver.c USB: Move runtime PM callbacks to usb_device_pm_ops 2011-03-18 19:55:36 +01:00
endpoint.c usb: set ep_dev async suspend should be later than device_initialize 2011-01-22 18:36:42 -08:00
file.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
generic.c USB: accept RNDIS configs if there's no alternative 2010-08-10 14:35:43 -07:00
hcd-pci.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-03-16 15:04:26 -07:00
hcd.c USB: Fix unplug of device with active streams 2011-04-13 16:57:33 -07:00
hub.c Fix common misspellings 2011-03-31 11:26:23 -03:00
inode.c fs: dcache remove dcache_lock 2011-01-07 17:50:23 +11: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: Change usb_hcd->bandwidth_mutex to a pointer. 2011-03-13 18:07:14 -07:00
notify.c
otg_whitelist.h
quirks.c USB: Add quirk for Samsung Android phone modem 2011-02-17 10:30:24 -08:00
sysfs.c USB: use the runtime-PM autosuspend implementation 2010-11-16 14:03:41 -08:00
urb.c USB: Add support for SuperSpeed isoc endpoints 2011-03-13 18:23:57 -07:00
usb.c USB: Move runtime PM callbacks to usb_device_pm_ops 2011-03-18 19:55:36 +01:00
usb.h USB: Move runtime PM callbacks to usb_device_pm_ops 2011-03-18 19:55:36 +01:00