From: sashiko-bot@kernel.org
To: "Fang Xieyan" <fangxy@xiaopeng.com>, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: r8a66597: fix NULL dereference for unmapped endpoints
Date: Wed, 11 Nov 2026 03:11:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-208161@kernel.org> (raw)
In-Reply-To: <20261111030206.64608-1-fangxy@xiaopeng.com>
> The epaddr2ep[] table is initialized with EP0 at probe time and
> populated for other endpoints when the gadget driver successfully
> enables them. Entries for endpoint numbers that have never been
> enabled remain NULL. The table is indexed by endpoint number and the
> lookup mask is USB_ENDPOINT_NUMBER_MASK, so the access itself stays in
> bounds; what is missing is the check for the NULL entry.
>
> get_status(), clear_feature() and set_feature() index this table using
> the host-controlled wIndex and immediately dereference the result
> without checking it. A malicious host can send a standard
> endpoint-recipient GET_STATUS, CLEAR_FEATURE or SET_FEATURE request for
> an unmapped endpoint number, triggering a NULL pointer dereference and
> crashing the kernel.
>
> Check the looked-up endpoint before using it. If the entry is NULL,
> stall the control pipe (pipe_stall(r8a66597, 0)) and abort the request,
> matching the existing handling of unsupported recipients.
>
> Fixes: c41442474a26 ("usb: gadget: R8A66597 peripheral controller support.")
> Cc: stable@vger.kernel.org
> Reviewed-by: Liu Chao <liuc63@xiaopeng.com>
> Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111030206.64608-1-fangxy@xiaopeng.com?part=1
prev parent reply other threads:[~2026-11-11 3:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 3:02 [PATCH] usb: gadget: r8a66597: fix NULL dereference for unmapped endpoints Fang Xieyan
2026-11-11 3:11 ` 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-208161@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fangxy@xiaopeng.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