提交 8cc54473 编写于 作者: V Viraj Shah 提交者: Zheng Zengkai

usb: musb: Balance list entry in musb_gadget_queue

stable inclusion
from stable-5.10.79
commit 1309753b7841db412063bcce3f2a0eddf1443e9d
bugzilla: 185793 https://gitee.com/openeuler/kernel/issues/I4K65C

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

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

commit 21b5fcdc upstream.

musb_gadget_queue() adds the passed request to musb_ep::req_list. If the
endpoint is idle and it is the first request then it invokes
musb_queue_resume_work(). If the function returns an error then the
error is passed to the caller without any clean-up and the request
remains enqueued on the list. If the caller enqueues the request again
then the list corrupts.

Remove the request from the list on error.

Fixes: ea2f35c0 ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NViraj Shah <viraj.shah@linutronix.de>
Link: https://lore.kernel.org/r/20211021093644.4734-1-viraj.shah@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NBin Li <huawei.libin@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 a40c4f80
...@@ -1247,9 +1247,11 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, ...@@ -1247,9 +1247,11 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
status = musb_queue_resume_work(musb, status = musb_queue_resume_work(musb,
musb_ep_restart_resume_work, musb_ep_restart_resume_work,
request); request);
if (status < 0) if (status < 0) {
dev_err(musb->controller, "%s resume work: %i\n", dev_err(musb->controller, "%s resume work: %i\n",
__func__, status); __func__, status);
list_del(&request->list);
}
} }
unlock: unlock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册