Commit dd65c095 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Greg Kroah-Hartman

usb: gadget: udc: renesas_usb3: fix deadlock by spinlock

commit 067d6fdc upstream.

This patch fixes an issue that this driver is possible to cause
deadlock by double-spinclocked in renesas_usb3_stop_controller().
So, this patch removes spinlock API calling in renesas_usb3_stop().
(In other words, the previous code had a redundant lock.)

Fixes: 746bfe63 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 723bd3b9
...@@ -1718,14 +1718,11 @@ static int renesas_usb3_start(struct usb_gadget *gadget, ...@@ -1718,14 +1718,11 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
static int renesas_usb3_stop(struct usb_gadget *gadget) static int renesas_usb3_stop(struct usb_gadget *gadget)
{ {
struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget); struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget);
unsigned long flags;
spin_lock_irqsave(&usb3->lock, flags);
usb3->softconnect = false; usb3->softconnect = false;
usb3->gadget.speed = USB_SPEED_UNKNOWN; usb3->gadget.speed = USB_SPEED_UNKNOWN;
usb3->driver = NULL; usb3->driver = NULL;
renesas_usb3_stop_controller(usb3); renesas_usb3_stop_controller(usb3);
spin_unlock_irqrestore(&usb3->lock, flags);
pm_runtime_put(usb3_to_dev(usb3)); pm_runtime_put(usb3_to_dev(usb3));
pm_runtime_disable(usb3_to_dev(usb3)); pm_runtime_disable(usb3_to_dev(usb3));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment