summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2017-09-26 15:15:49 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2017-09-28 12:30:59 +0300
commit7dbd8f4cabd96db5a50513de9d83a8105a5ffc81 (patch)
treeb65264c4c74ff8477910fae3cb8f1afa1bb4e1c1 /drivers/input
parent0173a68bfb0ad1c72a6ee39cc485aa2c97540b98 (diff)
downloadblackbird-op-linux-7dbd8f4cabd96db5a50513de9d83a8105a5ffc81.tar.gz
blackbird-op-linux-7dbd8f4cabd96db5a50513de9d83a8105a5ffc81.zip
USB: dummy-hcd: Fix erroneous synchronization change
A recent change to the synchronization in dummy-hcd was incorrect. The issue was that dummy_udc_stop() contained no locking and therefore could race with various gadget driver callbacks, and the fix was to add locking and issue the callbacks with the private spinlock held. UDC drivers aren't supposed to do this. Gadget driver callback routines are allowed to invoke functions in the UDC driver, and these functions will generally try to acquire the private spinlock. This would deadlock the driver. The correct solution is to drop the spinlock before issuing callbacks, and avoid races by emulating the synchronize_irq() call that all real UDC drivers must perform in their ->udc_stop() routines after disabling interrupts. This involves adding a flag to dummy-hcd's private structure to keep track of whether interrupts are supposed to be enabled, and adding a counter to keep track of ongoing callbacks so that dummy_udc_stop() can wait for them all to finish. A real UDC driver won't receive disconnect, reset, suspend, resume, or setup events once it has disabled interrupts. dummy-hcd will receive them but won't try to issue any gadget driver callbacks, which should be just as good. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Fixes: f16443a034c7 ("USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks") CC: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/input')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud