Skip to content

Commit

Permalink
usb: gadget: r8a66597-udc: do not unlock unheld spinlock in r8a66597_…
Browse files Browse the repository at this point in the history
…sudmac_irq()

r8a66597_irq() processes sudmac part (r8a66597_sudmac_irq()) before locking r8a66597->lock.
But transfer_complete(), that is called inside (r8a66597_sudmac_irq()->sudmac_finish()->transfer_complete()),
expects r8a66597->lock is locked. As a result unheld spinlock can be unlocked.

The patch just moves locking before calling r8a66597_sudmac_irq().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Alexey Khoroshilov authored and Felipe Balbi committed Jun 10, 2013
1 parent a2cc81d commit f37d49a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/r8a66597-udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,11 +1469,11 @@ static irqreturn_t r8a66597_irq(int irq, void *_r8a66597)
u16 savepipe;
u16 mask0;

spin_lock(&r8a66597->lock);

if (r8a66597_is_sudmac(r8a66597))
r8a66597_sudmac_irq(r8a66597);

spin_lock(&r8a66597->lock);

intsts0 = r8a66597_read(r8a66597, INTSTS0);
intenb0 = r8a66597_read(r8a66597, INTENB0);

Expand Down

0 comments on commit f37d49a

Please sign in to comment.