summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe F. Tonello <eu@felipetonello.com>2016-03-08 20:21:47 +0000
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-03-29 09:30:31 +0300
commit9acdf4df2fc4680b08fa242b09717892cd687d4a (patch)
tree476c46c65924a5631f2b0c8dfdc316165c89ca78 /drivers/usb/dwc3
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
usb: gadget: f_midi: added spinlock on transmit function
Since f_midi_transmit is called by both ALSA and USB sub-systems, it can potentially cause a race condition between both calls because f_midi_transmit is not reentrant nor thread-safe. This is due to an implementation detail that the transmit function looks for the next available usb request from the fifo and only enqueues it if there is data to send, otherwise just re-uses it. So, if both ALSA and USB frameworks calls this function at the same time, kfifo_seek() will return the same usb_request, which will cause a race condition. To solve this problem a syncronization mechanism is necessary. In this case it is used a spinlock since f_midi_transmit is also called by usb_request->complete callback in interrupt context. Cc: <stable@vger.kernel.org> # v4.5+ Fixes: e1e3d7ec5da3 ("usb: gadget: f_midi: pre-allocate IN requests") Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/dwc3')
0 files changed, 0 insertions, 0 deletions