From: Greg KH <gregkh@linuxfoundation.org>
To: Liu Chao <liuc63@xiaopeng.com>
Cc: neal_liu@aspeedtech.com, joel@jms.id.au,
andrew@codeconstruct.com.au, ryan_chen@aspeedtech.com,
billy_tsai@aspeedtech.com, linux-aspeed@lists.ozlabs.org,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
liuwb@xiaopeng.com
Subject: Re: [PATCH] usb: gadget: aspeed: clamp transfer length in RX completion handlers
Date: Fri, 20 Nov 2026 14:58:48 +0100 [thread overview]
Message-ID: <2026112035-syrup-universe-504f@gregkh> (raw)
In-Reply-To: <20260917103205.3049861-1-liuc63@xiaopeng.com>
On Thu, Sep 17, 2026 at 06:32:04PM +0800, Liu Chao wrote:
> ast_udc_ep0_out(), ast_udc_epn_handle() and ast_udc_epn_handle_desc()
> read the received byte count from hardware registers and add it to
> req->req.actual without clamping against the remaining buffer space
> (req->req.length - req->req.actual).
>
> When actual reaches or exceeds length, the subsequent DMA has already
> written past the end of the request buffer. Across multiple short
> packets the overrun grows with each completion.
>
> A malicious or malfunctioning USB host can exploit this to trigger a
> heap buffer overflow in any gadget function (e.g. f_mass_storage,
> f_fs) layered on top of this UDC.
We trust the hardware here, so how can this happen?
prev parent reply other threads:[~2026-11-20 13:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 10:32 [PATCH] usb: gadget: aspeed: clamp transfer length in RX completion handlers Liu Chao
2026-11-20 13:58 ` Greg KH [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=2026112035-syrup-universe-504f@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andrew@codeconstruct.com.au \
--cc=billy_tsai@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=liuc63@xiaopeng.com \
--cc=liuwb@xiaopeng.com \
--cc=neal_liu@aspeedtech.com \
--cc=ryan_chen@aspeedtech.com \
--cc=stable@vger.kernel.org \
/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