linux/drivers/usb
Yoshihiro Shimoda e752dbc59e usb: gadget: udc: renesas_usb3: Fix a race in usb3_start_pipen()
The usb3_start_pipen() is called by renesas_usb3_ep_queue() and
usb3_request_done_pipen() so that usb3_start_pipen() is possible
to cause a race when getting usb3_first_req like below:

renesas_usb3_ep_queue()
 spin_lock_irqsave()
 list_add_tail()
 spin_unlock_irqrestore()
 usb3_start_pipen()
  usb3_first_req = usb3_get_request() --- [1]
 --- interrupt ---
 usb3_irq_dma_int()
 usb3_request_done_pipen()
  usb3_get_request()
  usb3_start_pipen()
  usb3_first_req = usb3_get_request()
  ...
  (the req is possible to be finished in the interrupt)

The usb3_first_req [1] above may have been finished after the interrupt
ended so that this driver caused to start a transfer wrongly. To fix this
issue, getting/checking the usb3_first_req are under spin_lock_irqsave()
in the same section.

Fixes: 746bfe63bb ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20210524060155.1178724-1-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-24 15:22:28 +02:00
..
atm drivers: usb: atm: use pr_err() and pr_warn() instead of raw printk() 2020-12-09 15:22:51 +01:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 usb: cdnsp: Fix lack of removing request from pending list. 2021-05-11 14:15:42 +08:00
chipidea usb: chipidea: udc: assign interrupt number to USB gadget structure 2021-05-17 10:04:05 +08:00
class cdc-wdm: untangle a circular dependency between callback and softint 2021-05-10 14:39:51 +02:00
common usb: common: move function's kerneldoc next to its definition 2021-03-10 09:37:17 +01:00
core USB: usbfs: Don't WARN about excessively large memory allocations 2021-05-21 14:24:46 +02:00
dwc2 usb: dwc2: Remove obsolete MODULE_ constants from platform.c 2021-05-10 14:59:05 +02:00
dwc3 usb: dwc3: gadget: Properly track pending and queued SG 2021-05-21 14:25:07 +02:00
early usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() 2020-09-25 16:29:09 +02:00
gadget usb: gadget: udc: renesas_usb3: Fix a race in usb3_start_pipen() 2021-05-24 15:22:28 +02:00
host xhci: Add reset resume quirk for AMD xhci controller. 2021-05-13 14:47:36 +02:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760-hcd: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
misc USB: trancevibrator: fix control-request direction 2021-05-21 20:10:43 +02:00
mon
mtu3 usb: mtu3: drop CONFIG_OF 2021-03-26 14:47:19 +01:00
musb usb: musb: Fix an error message 2021-05-10 16:17:57 +02:00
phy usb: phy: phy-mxs-usb: Use of_device_get_match_data() 2021-01-18 18:35:46 +01:00
renesas_usbhs usb: renesas_usbhs: fix error return code of usbhsf_pkt_handler() 2021-03-23 12:42:15 +01:00
roles usb: roles: Call try_module_get() from usb_role_switch_find_by_fwnode() 2021-04-09 16:07:03 +02:00
serial USB: serial: pl2303: add device id for ADLINK ND-6530 GC 2021-05-10 11:15:23 +02:00
storage usb: storage: datafab: remove redundant assignment of variable result 2021-04-22 10:52:10 +02:00
typec usb: typec: tcpm: Respond Not_Supported if no snk_vdo 2021-05-24 15:14:25 +02:00
usbip Scheduler updates for this cycle are: 2021-04-28 13:33:57 -07:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver 2020-12-29 12:36:13 +08:00
usb-skeleton.c