--- zzzz-none-000/linux-2.6.39.4/drivers/usb/core/message.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/drivers/usb/core/message.c 2021-11-10 13:23:10.000000000 +0000 @@ -1136,7 +1136,8 @@ * pending urbs) and usbcore state for the interfaces, so that usbcore * must usb_set_configuration() before any interfaces could be used. * - * Must be called with hcd->bandwidth_mutex held. + * == 20161116 AVM/WKR deadlock fix, acquire lock directly before usb_hcd_alloc_bandwidth == + * Must NOT be called with hcd->bandwidth_mutex held. */ void usb_disable_device(struct usb_device *dev, int skip_ep0) { @@ -1189,7 +1190,12 @@ usb_disable_endpoint(dev, i + USB_DIR_IN, false); } /* Remove endpoints from the host controller internal state */ + /* 20161116 AVM/WKR deadlock fix, acquire lock directly before usb_hcd_alloc_bandwidth */ + mutex_lock(hcd->bandwidth_mutex); + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); + + mutex_unlock(hcd->bandwidth_mutex); /* Second pass: remove endpoint pointers */ } for (i = skip_ep0; i < 16; ++i) { @@ -1749,7 +1755,9 @@ /* if it's already configured, clear out old state first. * getting rid of old interfaces means unbinding their drivers. */ - mutex_lock(hcd->bandwidth_mutex); + + /* 20161116 AVM/WKR deadlock fix, acquire lock directly before usb_hcd_alloc_bandwidth */ + // mutex_lock(hcd->bandwidth_mutex); if (dev->state != USB_STATE_ADDRESS) usb_disable_device(dev, 1); /* Skip ep0 */ @@ -1762,7 +1770,10 @@ * host controller will not allow submissions to dropped endpoints. If * this call fails, the device state is unchanged. */ - ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); + + /* 20161116 AVM/WKR deadlock fix, acquire lock directly before usb_hcd_alloc_bandwidth */ + mutex_lock(hcd->bandwidth_mutex); + ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); if (ret < 0) { mutex_unlock(hcd->bandwidth_mutex); usb_autosuspend_device(dev);