diff options
author | Hangyu Hua <hbh25y@gmail.com> | 2022-01-01 01:21:37 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-01-03 14:35:18 +0100 |
commit | 89f3594d0de58e8a57d92d497dea9fee3d4b9cda (patch) | |
tree | e0563487b84e45c3c0f8b0d1308fef9eb27853b5 /drivers | |
parent | e0d07ba76bd1b074505e4b3b32fe45c3b5d087bd (diff) | |
download | linux-89f3594d0de58e8a57d92d497dea9fee3d4b9cda.tar.bz2 |
usb: gadget: don't release an existing dev->buf
dev->buf does not need to be released if it already exists before
executing dev_config.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20211231172138.7993-2-hbh25y@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/legacy/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 3b58f4fc0a80..eaad03c0252f 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -1826,8 +1826,9 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) spin_lock_irq (&dev->lock); value = -EINVAL; if (dev->buf) { + spin_unlock_irq(&dev->lock); kfree(kbuf); - goto fail; + return value; } dev->buf = kbuf; |