UPSTREAM: 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:6a19da1110("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> BUG: 266631160 (cherry picked from commit921deb9da1usb-linus) Change-Id: I7cd4445a6e1eee431fd1a1848b114181f4eea45c Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com>
This commit is contained in:
parent
56c8a40436
commit
869cae6f25
1 changed files with 3 additions and 1 deletions
|
|
@ -279,8 +279,10 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
|
|||
struct usb_request *req = ffs->ep0req;
|
||||
int ret;
|
||||
|
||||
if (!req)
|
||||
if (!req) {
|
||||
spin_unlock_irq(&ffs->ev.waitq.lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
req->zero = len < le16_to_cpu(ffs->ev.setup.wLength);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue