Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Elkin Cruz" <elkin@google.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: chipidea: udc: clean up bounce buffer and DMA mapping on enqueue error
Date: Wed, 25 Nov 2026 22:50:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-234283@kernel.org> (raw)
In-Reply-To: <20261125222212.1434148-1-elkin@google.com>

> In _hardware_enqueue(), sglist_do_bounce() allocates a bounce buffer and
> scatterlist table in hwreq->sgt and swaps hwreq->req.sg and
> hwreq->req.num_sgs to point at the bounce table. If
> usb_gadget_map_request_by_dev(), prepare_td_for_sg() /
> prepare_td_for_non_sg(), or hw_ep_prime() subsequently fails,
> _hardware_enqueue() returned without unwinding the bounce table, DMA
> mapping, or allocated TD nodes. Because failed requests are never added
> to hwep->qh.queue, _hardware_dequeue() and _ep_nuke() never clean them
> up, leaking the bounce buffer and leaving hwreq->req.sg corrupted.
> 
> When hw_ep_prime() fails, flush the endpoint and restore TD_TERMINATE in
> the queue head and any linked predecessor TD before freeing allocated TD
> nodes, unmapping the request, and calling sglist_do_debounce(hwreq,
> false).
> 
> Fixes: edfcc455c85c ("usb: chipidea: udc: create bounce buffer for problem sglist entries if possible")
> Cc: stable@vger.kernel.org
> Signed-off-by: Elkin Cruz <elkin@google.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125222212.1434148-1-elkin@google.com?part=1

      reply	other threads:[~2026-11-25 22:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 22:22 [PATCH] usb: chipidea: udc: clean up bounce buffer and DMA mapping on enqueue error Elkin Cruz
2026-11-25 22: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-234283@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=elkin@google.com \
    --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