diff options
author | David Eccher <d.eccher@gmail.com> | 2015-12-11 22:13:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-12 11:27:30 +0200 |
commit | c2eb312f3137d85a715af3f9009246b98e7ba993 (patch) | |
tree | e4277b766c3f827120fee286dff5135296d408a2 | |
parent | c030c36a88cdc54a5d657c0a2ee630ba495d5538 (diff) | |
download | linux-stable-c2eb312f3137d85a715af3f9009246b98e7ba993.tar.gz linux-stable-c2eb312f3137d85a715af3f9009246b98e7ba993.tar.bz2 linux-stable-c2eb312f3137d85a715af3f9009246b98e7ba993.zip |
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>
-rw-r--r-- | drivers/usb/gadget/legacy/inode.c | 3 |
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; |