It seems that only choose_devnum() was not ready to process more hub
events at the same time.
All should be fine if we take bus->usb_address0_mutex there. It will
make sure that more devnums will not be chosen for the given bus and
the related devices at the same time.
Signed-off-by: Petr Mladek <[email protected]>
Acked-by: Alan Stern <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
int devnum;
struct usb_bus *bus = udev->bus;
int devnum;
struct usb_bus *bus = udev->bus;
- /* If hub_wq ever becomes multithreaded, this will need a lock */
+ /* be safe when more hub events are proceed in parallel */
+ mutex_lock(&bus->usb_address0_mutex);
if (udev->wusb) {
devnum = udev->portnum + 1;
BUG_ON(test_bit(devnum, bus->devmap.devicemap));
if (udev->wusb) {
devnum = udev->portnum + 1;
BUG_ON(test_bit(devnum, bus->devmap.devicemap));
set_bit(devnum, bus->devmap.devicemap);
udev->devnum = devnum;
}
set_bit(devnum, bus->devmap.devicemap);
udev->devnum = devnum;
}
+ mutex_unlock(&bus->usb_address0_mutex);
}
static void release_devnum(struct usb_device *udev)
}
static void release_devnum(struct usb_device *udev)
* USB-PERSIST port handover. Otherwise it might see that a full-speed
* device was gone before the EHCI controller had handed its port
* over to the companion full-speed controller.
* USB-PERSIST port handover. Otherwise it might see that a full-speed
* device was gone before the EHCI controller had handed its port
* over to the companion full-speed controller.
- *
- * Also we use ordered workqueue because the code is not ready
- * for parallel execution of hub events, see choose_devnum().
- hub_wq = alloc_ordered_workqueue("usb_hub_wq", WQ_FREEZABLE);
+ hub_wq = alloc_workqueue("usb_hub_wq", WQ_FREEZABLE, 0);