usb: hub: take hub->hdev reference when processing from eventlist
authorJoe Lawrence <[email protected]>
Wed, 10 Sep 2014 19:07:50 +0000 (15:07 -0400)
committerGreg Kroah-Hartman <[email protected]>
Wed, 10 Sep 2014 20:32:35 +0000 (13:32 -0700)
commitc605f3cdff53a743f6d875b76956b239deca1272
tree3ea0899daecae8401afa16e5feec9f0124257eae
parenta9c54caa456dccba938005f6479892b589975e6a
usb: hub: take hub->hdev reference when processing from eventlist

During surprise device hotplug removal tests, it was observed that
hub_events may try to call usb_lock_device on a device that has already
been freed. Protect the usb_device by taking out a reference (under the
hub_event_lock) when hub_events pulls it off the list, returning the
reference after hub_events is finished using it.

Signed-off-by: Joe Lawrence <[email protected]>
Suggested-by: David Bulkow <[email protected]> for using kref
Suggested-by: Alan Stern <[email protected]> for placement
Acked-by: Alan Stern <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/core/hub.c