USB: inode.c: fix unbalanced spin_lock in ep0_write
PATCH 1/1 USB: inode.c: fix unbalanced spin_lock in ep0_write
Fix bad unlock balance: ep0_write enter with the locks locked from inode.c:1769, hence it must exit with spinlock held to avoid double unlock in dev_config.
--- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/legacy/inode.c +1 -0
@@ -1144,6 +1144,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) }else retval = len; +spin_lock_irq (&dev->lock);return retval; }
Signature · 1 line
1.8.1.2
Quoted 2 lines · David Eccher
Fix bad unlock balance:
ep0_writeenter with the locks locked from inode.c:1769, hence it must exit with spinlock held to avoid double unlock indev_config.
*Ugh*
Just take that spinlock before the if (retval < 0) and don't drop it after clear_req(), then...
Quoted 9 lines · Al Viro
Quoted 2 lines · David Eccher
Fix bad unlock balance:
ep0_writeenter with the locks locked from inode.c:1769, hence it must exit with spinlock held to avoid double unlock indev_config.*Ugh*
Just take that spinlock before the if (retval < 0) and don't drop it after
clear_req(), then...
Oh, yeah good point, I'll send a v2...and test the patch thru checkpatch.pl, sorry
Signature · 1 line
David Eccher
Hello.
Quoted 13 lines · David Eccher
Fix bad unlock balance:
ep0_writeenter with the locks locked from inode.c:1769, hence it must exit with spinlock held to avoid double unlock indev_config.Signed-off-by David Eccher <[email protected]>--- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+)drivers/usb/gadget/legacy/inode.c +0
-0
drivers/usb/gadget/legacy/inode.c ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) · line 1147
Quoted 4 lines
drivers/usb/gadget/legacy/inode.c +1
-0@@ -1144,6 +1144,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) }else retval = len; +spin_lock_irq (&dev->lock);
I guess you hadn't run the patch thru scripts/checkpatch.pl?
MBR, Sergei