summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-09-26 13:09:53 -0400
committerBen Hutchings <ben@decadent.org.uk>2012-10-10 03:31:07 +0100
commit0ecf1c24aec118ccbc0c67f2fd61a1313b56f322 (patch)
treed00e17d8018e9966bbec312f3fa272a224d47fcf /kernel
parent4e19de3be14c9390e63271effb5b95ab50f298f4 (diff)
USB: Fix race condition when removing host controllers
commit 0d00dc2611abbe6ad244d50569c2ee82ce42846c upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions