Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4dbda1

Browse files
AlanSterngregkh
authored andcommitted
USB: dummy-hcd: disable interrupts during req->complete
This patch (as756) fixes a bug in dummy-hcd found by the lockdep checker. In one of the code paths, the driver did not disable interrupts before calling a request completion routine. Signed-off-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent be0c801 commit b4dbda1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/gadget/dummy_hcd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
609609
if (!dum->driver)
610610
return -ESHUTDOWN;
611611

612-
spin_lock_irqsave (&dum->lock, flags);
612+
local_irq_save (flags);
613+
spin_lock (&dum->lock);
613614
list_for_each_entry (req, &ep->queue, queue) {
614615
if (&req->req == _req) {
615616
list_del_init (&req->queue);
@@ -618,14 +619,15 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
618619
break;
619620
}
620621
}
621-
spin_unlock_irqrestore (&dum->lock, flags);
622+
spin_unlock (&dum->lock);
622623

623624
if (retval == 0) {
624625
dev_dbg (udc_dev(dum),
625626
"dequeued req %p from %s, len %d buf %p\n",
626627
req, _ep->name, _req->length, _req->buf);
627628
_req->complete (_ep, _req);
628629
}
630+
local_irq_restore (flags);
629631
return retval;
630632
}
631633

0 commit comments

Comments
 (0)