]> git.hungrycats.org Git - linux/commitdiff
Revert "usb: gadget: inode.c: fix unbalanced spin_lock in ep0_write"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Oct 2017 14:12:49 +0000 (16:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Oct 2017 07:15:17 +0000 (09:15 +0200)
This reverts commit abb540b5397674243994c5327146b6fed7339b71 which is
commit b7bd98b7db9f upstream.  I had added it to make another patch
apply cleanly, but as Ben points out, that was wrong.

Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: David Eccher <d.eccher@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
drivers/usb/gadget/legacy/inode.c

index 352c59cff5b61ffd2c89aa46bf9ffc1c522aaf37..368d07937848a1e301550a34801ad5523c6cf416 100644 (file)
@@ -1231,10 +1231,11 @@ 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);
                                --dev->udc_usage;
                                if (retval < 0) {
+                                       spin_lock_irq (&dev->lock);
                                        clean_req (dev->gadget->ep0, dev->req);
+                                       spin_unlock_irq (&dev->lock);
                                } else
                                        retval = len;