Patch "usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-gadget-udc-renesas_usb3-fix-usb_gadget_giveback_request-calling.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
aca5b9ebd096039657417c321a9252c696b359c2Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <[email protected]>
Date: Wed, 2 Aug 2017 21:06:35 +0900
Subject: usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling
From: Yoshihiro Shimoda <[email protected]>
commit aca5b9ebd096039657417c321a9252c696b359c2 upstream.
According to the gadget.h, a "complete" function will always be called with interrupts disabled. However, sometimes usb3_request_done() function is called with interrupts enabled. So, this function should be held by spin_lock_irqsave() to disable interruption. Also, this driver has to call spin_unlock() to avoid spinlock recursion by this driver before calling usb_gadget_giveback_request().
--- drivers/usb/gadget/udc/renesas_usb3.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/usb/gadget/udc/renesas_usb3.c +16 -5
@@ -685,21 +685,32 @@ static struct renesas_usb3_request *usb3return usb3_req; } -static void usb3_request_done (struct renesas_usb3_ep *usb3_ep, -struct renesas_usb3_request *usb3_req,int status) +static void __usb3_request_done (struct renesas_usb3_ep *usb3_ep, +struct renesas_usb3_request *usb3_req, +int status) {struct renesas_usb3 *usb3 =usb3_ep_to_usb3 (usb3_ep); -unsigned long flags;dev_dbg (usb3_to_dev (usb3),"giveback: ep%2d, %u, %u, %d\n" , usb3_ep->num, usb3_req->req.length, usb3_req->req.actual, status); usb3_req->req.status = status; -spin_lock_irqsave (&usb3->lock, flags); usb3_ep->started = false;list_del_init (&usb3_req->queue); -spin_unlock_irqrestore (&usb3->lock, flags); +spin_unlock (&usb3->lock);usb_gadget_giveback_request (&usb3_ep->ep, &usb3_req->req); +spin_lock (&usb3->lock); +} + +static void usb3_request_done (struct renesas_usb3_ep *usb3_ep, +struct renesas_usb3_request *usb3_req,int status) +{ +struct renesas_usb3 *usb3 =usb3_ep_to_usb3 (usb3_ep); +unsigned long flags; + +spin_lock_irqsave (&usb3->lock, flags); +__usb3_request_done (usb3_ep, usb3_req, status); +spin_unlock_irqrestore (&usb3->lock, flags); }static void usb3_irq_epc_pipe0_status_end (struct renesas_usb3 *usb3)
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/usb-renesas_usbhs-fix-ugctrl2-value-for-r-car-gen3.patch queue-4.9/usb-gadget-udc-renesas_usb3-fix-usb_gadget_giveback_request-calling.patch