From: Greg KH <gregkh@linuxfoundation.org>
To: Liu Chao <liuc63@xiaopeng.com>
Cc: michal.simek@amd.com, 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: udc-xilinx: clamp bytes_to_rx in xudc_ep0_out()
Date: Fri, 20 Nov 2026 15:12:40 +0100 [thread overview]
Message-ID: <2026112022-babied-unplowed-3ede@gregkh> (raw)
In-Reply-To: <20260917123111.3757737-1-liuc63@xiaopeng.com>
On Thu, Sep 17, 2026 at 08:31:11PM +0800, Liu Chao wrote:
> xudc_ep0_out() reads the received byte count from a hardware register
> and adds it to req->usb_req.actual without checking whether it exceeds
> the remaining buffer space (req->usb_req.length - req->usb_req.actual).
> The same unclamped count is then passed to memcpy_toio(), which can
> write past the end of the request buffer.
>
> A malicious USB host can send more data than the gadget function
> expects on a control OUT transfer, triggering a heap buffer overflow.
>
> Note that Haofeng Li's recent patch for the non-EP0 path
> (xudc_read_fifo) explicitly excludes EP0, so this code path was not
> covered by that fix.
>
> Clamp bytes_to_rx to the remaining buffer space before accumulating it.
>
> Fixes: 1f7b0c6d8e34 ("usb: gadget: udc-xilinx: Add Software data structures and APIs for xilinx udc")
Don't make up git ids. You did this for many of your patches, I've
dropped them all now.
greg k-h
prev parent reply other threads:[~2026-11-20 14:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 12:31 Liu Chao
2026-11-20 14:12 ` 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=2026112022-babied-unplowed-3ede@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=liuc63@xiaopeng.com \
--cc=liuwb@xiaopeng.com \
--cc=michal.simek@amd.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
all inboxes | Powered by JetHome®