summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/legacy/inode.c
diff options
context:
space:
mode:
authorDavid Eccher <d.eccher@gmail.com>2015-12-11 22:13:55 +0100
committerFelipe Balbi <balbi@ti.com>2015-12-16 15:19:11 -0600
commitb7bd98b7db9fc8fe19da1a5ff0215311c6b95e46 (patch)
tree07d1815a9de5a9c43c3940ad933fa10072c46b48 /drivers/usb/gadget/legacy/inode.c
parentd0450272a6b9c6326017f490a808eb7caf214400 (diff)
usb: gadget: 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. Signed-off-by: David Eccher <d.eccher@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/legacy/inode.c')
-rw-r--r--drivers/usb/gadget/legacy/inode.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index f454c7af489c..365afd7e14f8 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1137,10 +1137,9 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
dev->gadget->ep0, dev->req,
GFP_KERNEL);
}
+ spin_lock_irq(&dev->lock);
if (retval < 0) {
- spin_lock_irq (&dev->lock);
clean_req (dev->gadget->ep0, dev->req);
- spin_unlock_irq (&dev->lock);
} else
retval = len;