Skip to content

Commit c2eb312

Browse files
eccherdagregkh
authored andcommitted
usb: gadget: inode.c: fix unbalanced spin_lock in ep0_write
commit b7bd98b7db9fc8fe19da1a5ff0215311c6b95e46 upstream. 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. Signed-off-by: David Eccher <d.eccher@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c030c36 commit c2eb312

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/usb/gadget/legacy/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,10 +1140,9 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
11401140
dev->gadget->ep0, dev->req,
11411141
GFP_KERNEL);
11421142
}
1143+
spin_lock_irq(&dev->lock);
11431144
if (retval < 0) {
1144-
spin_lock_irq (&dev->lock);
11451145
clean_req (dev->gadget->ep0, dev->req);
1146-
spin_unlock_irq (&dev->lock);
11471146
} else
11481147
retval = len;
11491148

0 commit comments

Comments
 (0)