Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jaeyeong Lee" <lee@jaeyeong.cc>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v1] usb: cdns3: Fix WA2 request UAF on endpoint disable
Date: Wed, 11 Nov 2026 13:42:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-209083@kernel.org> (raw)
In-Reply-To: <20261111132346.9262-1-lee@jaeyeong.cc>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] usb: cdns3: missing DMA unmap for deferred WA2 requests in
  cdns3_gadget_ep_disable()
--

commit 15008f28246eb4c2cca9af667c3695fb8684956a
Author: Jaeyeong Lee <lee@jaeyeong.cc>

usb: cdns3: Fix WA2 request UAF on endpoint disable

This commit initializes priv_req->request.list when adding an internal WA2
request to wa2_descmiss_req_list and removes it during
cdns3_gadget_ep_disable() before freeing the request.

> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 380c4fde8298e..770fbeee53484 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c

[ ... ]

> @@ -2547,6 +2549,7 @@ static int cdns3_gadget_ep_disable(struct usb_ep *ep)
>  	while (!list_empty(&priv_ep->wa2_descmiss_req_list)) {
>  		priv_req = cdns3_next_priv_request(&priv_ep->wa2_descmiss_req_list);
>  		list_del_init(&priv_req->list);
> +		list_del_init(&priv_req->request.list);
>  
>  		kfree(priv_req->request.buf);
>  		cdns3_gadget_ep_free_request(&priv_ep->endpoint,

[Severity: Medium]
Does this free priv_req->request.buf while it is still mapped for DMA when
an internal WA2 request is on priv_ep->deferred_req_list?

__cdns3_gadget_ep_queue() calls usb_gadget_map_request_by_dev() before
adding priv_req->request.list to priv_ep->deferred_req_list.  Requests on
priv_ep->pending_req_list are unmapped by cdns3_gadget_giveback() in the
preceding loop, but unlinking priv_req->request.list here removes a
deferred WA2 request before the deferred_req_list giveback loop runs,
leaking the DMA mapping and triggering a DMA-API warning when
priv_req->request.buf is freed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111132346.9262-1-lee@jaeyeong.cc?part=1

      reply	other threads:[~2026-11-11 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 13:23 [PATCH v1] usb: cdns3: Fix WA2 request UAF on endpoint disable Jaeyeong Lee
2026-11-11 13:42 ` 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-209083@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@jaeyeong.cc \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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