Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Wang <joe_wang@aspeedtech.com>
To: TAKANO Mitsuhiro <takano32@gmail.com>
Cc: Neal Liu <neal_liu@aspeedtech.com>,
	Neill Kapron <nkapron@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.au>,
	Ryan Chen <ryan_chen@aspeedtech.com>,
	Billy Tsai <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>
Subject: Re: [PATCH] usb: gadget: aspeed_udc: validate pointers before dereferencing in ast_udc_ep_enable()
Date: Thu, 3 Dec 2026 15:26:47 +0800	[thread overview]
Message-ID: <20261203072647.3026031-1-joe_wang@aspeedtech.com> (raw)
In-Reply-To: <20261128-b4-aspeed-udc-ep-enable-null-v1-1-26e41e0cd96b@gmail.com>

Hi Takano,

> In ast_udc_ep_enable(), desc and ep are dereferenced in local variable
> initializers (usb_endpoint_maxp(desc), ep->udc, and usb_endpoint_num(desc))
> before checking whether _ep or desc is NULL. In addition, the error path
> calls EP_DBG(ep, ...), which dereferences ep->udc and ep->ep.name when
> AST_EP_DEBUG is enabled.

Thanks for the patch, but I don't think this change is needed.

ast_udc_ep_enable() is only reached through ep->ops->enable(), and the
only caller of that is usb_ep_enable() in udc/core.c. usb_ep_enable()
already dereferences ep (ep->enabled) before the call, and it returns
-EINVAL with a WARN if ep->desc is NULL or its maxpacket is 0, so _ep
and desc can never be NULL by the time ast_udc_ep_enable() runs.

Because of that there is no NULL dereference to fix here, and the
Fixes: tag does not apply.

Thanks,
Joe Wang


      reply	other threads:[~2026-12-03  7:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 22:21 [PATCH] usb: gadget: aspeed_udc: validate pointers before dereferencing in ast_udc_ep_enable() TAKANO Mitsuhiro via B4 Relay
2026-12-03  7:26 ` Joe Wang [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=20261203072647.3026031-1-joe_wang@aspeedtech.com \
    --to=joe_wang@aspeedtech.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=billy_tsai@aspeedtech.com \
    --cc=gregkh@linuxfoundation.org \
    --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=neal_liu@aspeedtech.com \
    --cc=nkapron@google.com \
    --cc=ryan_chen@aspeedtech.com \
    --cc=takano32@gmail.com \
    /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