From: sashiko-bot@kernel.org
To: tjdqudcks0424@naver.com
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usbip: vudc: reject submits after endpoint state changes
Date: Thu, 08 Oct 2026 18:50:30 +0000 [thread overview]
Message-ID: <sashiko-outbox-164480@kernel.org> (raw)
In-Reply-To: <20261008183753.10231-1-tjdqudcks0424@naver.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] usbip: vudc: connection state leak on stale URB submit
--
commit b5cb3556d735fa03d4a0491206e54476efc259b5
Author: Sung Byeongchan <tjdqudcks0424@naver.com>
usbip: vudc: reject submits after endpoint state changes
v_recv_cmd_submit() looks up an endpoint under udc->lock, but drops the
lock while it allocates the URB and receives the payload. A gadget
configuration change can disable or disable and re-enable that endpoint
before the URB is queued. This commit adds a generation counter to reject
stale requests with -ESHUTDOWN.
> diff --git a/drivers/usb/usbip/vudc_rx.c b/drivers/usb/usbip/vudc_rx.c
> index 51bb70837b902..3c459c7b57b5f 100644
> --- a/drivers/usb/usbip/vudc_rx.c
> +++ b/drivers/usb/usbip/vudc_rx.c
[ ... ]
> @@ -175,6 +179,13 @@ static int v_recv_cmd_submit(struct vudc *udc,
> goto free_urbp;
>
> spin_lock_irqsave(&udc->lock, flags);
> + if (urb_p->ep != &udc->ep[0] &&
> + (!urb_p->ep->desc ||
> + urb_p->ep->generation != urb_p->ep_generation)) {
> + spin_unlock_irqrestore(&udc->lock, flags);
> + ret = -ESHUTDOWN;
> + goto free_urbp;
> + }
[Severity: Medium]
Does this new error path omit a required usbip_event_add() call?
When this error path in v_recv_cmd_submit() returns -ESHUTDOWN, the negative
return value propagates to v_rx_pdu() and then to v_rx_loop(), causing the RX
thread loop to break and the thread to exit.
Because the usbip_event_add(&udc->ud, VUDC_EVENT_ERROR_TCP) event notification
is missing here, the usbip_work teardown routine is never scheduled. As a
result, the TX thread remains indefinitely blocked on tx_waitq, the socket
reference is not released, and the device state remains stuck in SDEV_ST_USED.
Could this be triggered when a host submits an URB to an endpoint whose
generation has changed, leaking the connection state on the server until manual
administrative intervention?
> v_kick_timer(udc, jiffies);
> list_add_tail(&urb_p->urb_entry, &udc->urb_queue);
> spin_unlock_irqrestore(&udc->lock, flags);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008183753.10231-1-tjdqudcks0424@naver.com?part=1
prev parent reply other threads:[~2026-10-08 18:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 18:37 [PATCH] usbip: vudc: reject submits after endpoint state changes tjdqudcks0424
2026-10-08 18:50 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-164480@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tjdqudcks0424@naver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox