usb: gadget: f_fs: Fix unbalanced spinlock in __ffs_ep0_queue_wait

__ffs_ep0_queue_wait executes holding the spinlock of &ffs->ev.waitq.lock
and unlocks it after the assignments to usb_request are done.
However in the code if the request is already NULL we bail out returning
-EINVAL but never unlocked the spinlock.

Fix this by adding spin_unlock_irq &ffs->ev.waitq.lock before returning.

Fixes: 6a19da111057 ("usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait")
Reviewed-by: John Keeping <john@metanate.com>
Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com>
Link: https://lore.kernel.org/r/20230124091149.18647-1-quic_ugoswami@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Udipto Goswami and committed by Greg Kroah-Hartman 921deb9d eb320f76

Changed files
+3 -1
drivers
usb
gadget
function
+3 -1
drivers/usb/gadget/function/f_fs.c
··· 279 279 struct usb_request *req = ffs->ep0req; 280 280 int ret; 281 281 282 - if (!req) 282 + if (!req) { 283 + spin_unlock_irq(&ffs->ev.waitq.lock); 283 284 return -EINVAL; 285 + } 284 286 285 287 req->zero = len < le16_to_cpu(ffs->ev.setup.wLength); 286 288