linux/drivers/usb/core
Herbert Xu 2de6fff198 USB: Move hcd free_dev call into usb_disconnect to fix oops
commit f7410ced7f upstream.

USB: Move hcd free_dev call into usb_disconnect

I found a way to oops the kernel:

1. Open a USB device through devio.
2. Remove the hcd module in the host kernel.
3. Close the devio file descriptor.

The problem is that closing the file descriptor does usb_release_dev
as it is the last reference.  usb_release_dev then tries to invoke
the hcd free_dev function (or rather dereferencing the hcd driver
struct).  This causes an oops as the hcd driver has already been
unloaded so the struct is gone.

This patch tries to fix this by bringing the free_dev call earlier
and into usb_disconnect.  I have verified that repeating the
above steps no longer crashes with this patch applied.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-15 08:50:09 -07:00
..
buffer.c USB: pass mem_flags to dma_alloc_coherent 2009-04-23 14:15:28 -07:00
config.c USB: Fix SS endpoint companion descriptor parsing. 2009-09-23 06:46:18 -07:00
devices.c USB: Don't use GFP_KERNEL while we cannot reset a storage device 2010-01-25 10:49:31 -08:00
devio.c USB: usbfs: properly clean up the as structure on error paths 2010-02-23 07:37:57 -08:00
driver.c USB: remove debugging message for uevent constructions 2010-03-15 08:50:08 -07:00
endpoint.c driver model: constify attribute groups 2009-09-15 09:50:47 -07:00
file.c Driver-Core: extend devnode callbacks to provide permissions 2009-09-19 12:50:38 -07:00
generic.c USB: add API for userspace drivers to "claim" ports 2009-09-23 06:46:22 -07:00
hcd-pci.c USB: new flag for resume-from-hibernation 2009-06-15 21:44:44 -07:00
hcd.c USB: fix the idProduct value for USB-3.0 root hubs 2010-03-15 08:50:08 -07:00
hcd.h USB: Move hcd free_dev call into usb_disconnect to fix oops 2010-03-15 08:50:09 -07:00
hub.c USB: Move hcd free_dev call into usb_disconnect to fix oops 2010-03-15 08:50:09 -07:00
hub.h USB: fix the clear_tt_buffer interface 2009-07-12 15:16:38 -07:00
inode.c const: mark remaining super_operations const 2009-09-22 07:17:24 -07:00
Kconfig Revert USB: usbfs: deprecate and hide option for !embedded 2009-07-12 15:16:39 -07:00
Makefile USB: add the usbfs devices file to debugfs 2009-06-15 21:44:43 -07:00
message.c USB: Don't use GFP_KERNEL while we cannot reset a storage device 2010-01-25 10:49:31 -08:00
notify.c
otg_whitelist.h
quirks.c USB: add quirk to avoid config and interface strings 2009-03-24 16:20:25 -07:00
sysfs.c USB: add speed values for USB 3.0 and wireless controllers 2010-01-25 10:49:34 -08:00
urb.c USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
usb.c USB: Move hcd free_dev call into usb_disconnect to fix oops 2010-03-15 08:50:09 -07:00
usb.h USB: add API for userspace drivers to "claim" ports 2009-09-23 06:46:22 -07:00