summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorDavid Eccher <d.eccher@gmail.com>2015-12-11 22:13:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-12 11:27:30 +0200
commitc2eb312f3137d85a715af3f9009246b98e7ba993 (patch)
treee4277b766c3f827120fee286dff5135296d408a2 /drivers/usb/gadget
parentc030c36a88cdc54a5d657c0a2ee630ba495d5538 (diff)
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>
Diffstat (limited to 'drivers/usb/gadget')
-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 43ce2cfcdb4d..2edb6948c552 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1140,10 +1140,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;