Commit eb7b5785 authored by Udipto Goswami's avatar Udipto Goswami Committed by zhaoxiaoqiang11
Browse files

usb: gadget: f_fs: Fix unbalanced spinlock in __ffs_ep0_queue_wait

stable inclusion
from stable-v5.10.168
commit 434a36ed64ac399b567174075b75d59d916dadfc
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7URR4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=434a36ed64ac399b567174075b75d59d916dadfc



----------------------------------------------------

[ Upstream commit 921deb9d ]

__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: 6a19da11 ("usb: gadget: f_fs: Prevent race during ffs_ep0_queue_wait")
Reviewed-by: default avatarJohn Keeping <john@metanate.com>
Signed-off-by: default avatarUdipto Goswami <quic_ugoswami@quicinc.com>
Link: https://lore.kernel.org/r/20230124091149.18647-1-quic_ugoswami@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
parent 5da922f6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment