linux/drivers/usb/core
Alan Stern 0d00dc2611 USB: Fix race condition when removing host controllers
This patch (as1607) fixes a race that can occur if a USB host
controller is removed while a process is reading the
/sys/kernel/debug/usb/devices file.

The usb_device_read() routine uses the bus->root_hub pointer to
determine whether or not the root hub is registered.  The is not a
valid test, because the pointer is set before the root hub gets
registered and remains set even after the root hub is unregistered and
deallocated.  As a result, usb_device_read() or usb_device_dump() can
access freed memory, causing an oops.

The patch changes the test to use the hcd->rh_registered flag, which
does get set and cleared at the appropriate times.  It also makes sure
to hold the usb_bus_list_lock mutex while setting the flag, so that
usb_device_read() will become aware of new root hubs as soon as they
are registered.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Don Zickus <dzickus@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-27 09:17:49 -07:00
..
Kconfig usb: Kconfig: remove unneeded default value 2012-05-14 08:49:50 -07:00
Makefile usb: Bind devices to ACPI devices when possible 2012-05-11 17:06:13 -07:00
buffer.c
config.c
devices.c USB: Fix race condition when removing host controllers 2012-09-27 09:17:49 -07:00
devio.c usbdevfs: Use scatter-gather lists for large bulk transfers 2012-07-06 10:53:20 -07:00
driver.c usb: Add quirk detection based on interface information 2012-07-19 15:44:58 -07:00
endpoint.c
file.c USB: rename the usb misc class from "usb" to "usbmisc" 2012-06-13 15:37:13 -07:00
generic.c
hcd-pci.c USB: add NO_D3_DURING_SLEEP flag and revert 151b612847 2012-06-13 13:11:39 -07:00
hcd.c USB: Fix race condition when removing host controllers 2012-09-27 09:17:49 -07:00
hub.c This patch series contains a major revamp of how we collect entropy 2012-07-31 19:07:42 -07:00
message.c USB: Enable Latency Tolerance Messaging (LTM). 2012-07-11 07:06:48 -04:00
notify.c
otg_whitelist.h
quirks.c USB: add device quirk for Joss Optical touchboard 2012-09-05 16:56:58 -07:00
sysfs.c USB: Add a sysfs file to show LTM capabilities. 2012-07-11 07:06:48 -04:00
urb.c usbhid: prevent deadlock during timeout 2012-05-01 13:22:13 -04:00
usb-acpi.c usb: Set device removable state based on ACPI USB data 2012-05-11 17:07:02 -07:00
usb.c USB: Disable LPM while the device is unconfigured. 2012-07-11 07:06:46 -04:00
usb.h usb: Add quirk detection based on interface information 2012-07-19 15:44:58 -07:00