From: Hangyu Hua Date: Fri, 31 Dec 2021 17:21:37 +0000 (+0800) Subject: usb: gadget: don't release an existing dev->buf X-Git-Tag: v6.6.17~8430^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89f3594d0de58e8a57d92d497dea9fee3d4b9cda;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20211231172138.7993-2-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 3b58f4f..eaad03c 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;