Skip to content

Commit

Permalink
usb: gadget: udc: renesas_usb3: fix deadlock by spinlock
Browse files Browse the repository at this point in the history
commit 067d6fd 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: 746bfe6 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
shimoday authored and gregkh committed Jun 24, 2017
1 parent 723bd3b commit dd65c09
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/usb/gadget/udc/renesas_usb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,14 +1718,11 @@ static int renesas_usb3_start(struct usb_gadget *gadget,
static int renesas_usb3_stop(struct usb_gadget *gadget)
{
struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget);
unsigned long flags;

spin_lock_irqsave(&usb3->lock, flags);
usb3->softconnect = false;
usb3->gadget.speed = USB_SPEED_UNKNOWN;
usb3->driver = NULL;
renesas_usb3_stop_controller(usb3);
spin_unlock_irqrestore(&usb3->lock, flags);

pm_runtime_put(usb3_to_dev(usb3));
pm_runtime_disable(usb3_to_dev(usb3));
Expand Down

0 comments on commit dd65c09

Please sign in to comment.