diff options
author | Gregory Herrero <gregory.herrero@intel.com> | 2015-11-05 09:41:41 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-12-15 16:12:41 +0100 |
commit | 2b046bc5aaefd4aba7195e6a73afe14f7f786692 (patch) | |
tree | 3a974eac2470d65be909312acc9308fab1c964d8 /drivers/usb/dwc2/hcd_ddma.c | |
parent | usb: dwc2: host: fix use of qtd after free in desc dma mode (diff) | |
download | linux-2b046bc5aaefd4aba7195e6a73afe14f7f786692.tar.xz linux-2b046bc5aaefd4aba7195e6a73afe14f7f786692.zip |
usb: dwc2: host: spinlock release channel
Prevent dwc2 driver from accessing channel while it frees it.
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2/hcd_ddma.c')
-rw-r--r-- | drivers/usb/dwc2/hcd_ddma.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c index 4801e693353a..a76a58c35fea 100644 --- a/drivers/usb/dwc2/hcd_ddma.c +++ b/drivers/usb/dwc2/hcd_ddma.c @@ -360,6 +360,8 @@ err0: */ void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) { + unsigned long flags; + dwc2_desc_list_free(hsotg, qh); /* @@ -369,8 +371,10 @@ void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) * when it comes here from endpoint disable routine * channel remains assigned. */ + spin_lock_irqsave(&hsotg->lock, flags); if (qh->channel) dwc2_release_channel_ddma(hsotg, qh); + spin_unlock_irqrestore(&hsotg->lock, flags); if ((qh->ep_type == USB_ENDPOINT_XFER_ISOC || qh->ep_type == USB_ENDPOINT_XFER_INT) && |