From: Greg KH <gregkh@linuxfoundation.org>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: pawell@cadence.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] usb: cdns2: fix a null pointer dereference in cdns2_gadget_ep_queue()
Date: Wed, 24 Dec 2025 10:45:13 +0100 [thread overview]
Message-ID: <2025122448-snowbound-married-f070@gregkh> (raw)
In-Reply-To: <20251224093845.1578894-1-lihaoxiang@isrc.iscas.ac.cn>
On Wed, Dec 24, 2025 at 05:38:45PM +0800, Haoxiang Li wrote:
> If cdns2_gadget_ep_alloc_request() fails, a null pointer dereference
> occurs. Add a check to prevent it.
>
> Fixes: 3eb1f1efe204 ("usb: cdns2: Add main part of Cadence USBHS driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> drivers/usb/gadget/udc/cdns2/cdns2-gadget.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
> index 9b53daf76583..c5b9dae743d8 100644
> --- a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
> +++ b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c
> @@ -1725,6 +1725,8 @@ static int cdns2_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
> struct cdns2_request *preq;
>
> zlp_request = cdns2_gadget_ep_alloc_request(ep, GFP_ATOMIC);
> + if (!zlp_request)
> + return -ENOMEM;
As stated before, you need to document the tool that you use to find
these types of things.
And how was this tested?
thanks,
greg k-h
prev parent reply other threads:[~2025-12-24 9:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-24 9:38 [PATCH] usb: cdns2: fix a null pointer dereference in cdns2_gadget_ep_queue() Haoxiang Li
2025-12-24 9:45 ` 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=2025122448-snowbound-married-f070@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.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