From: Greg KH <gregkh@linuxfoundation.org>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: kees@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: renesas_usbhs: Check pipe allocation in host pipe init
Date: Thu, 25 Jun 2026 14:55:19 +0100 [thread overview]
Message-ID: <2026062533-dock-frosting-5a64@gregkh> (raw)
In-Reply-To: <20260622114521.1022197-1-haoxiang_li2024@163.com>
On Mon, Jun 22, 2026 at 07:45:21PM +0800, Haoxiang Li wrote:
> usbhsh_pipe_init_for_host() allocates pipes with usbhs_dcp_malloc()
> or usbhs_pipe_malloc(), both of which may return NULL. The returned
> pointer is dereferenced unconditionally when clearing pipe->mod_private.
>
> Check the returned pipe before using it to avoid a NULL pointer
> dereference on pipe allocation/setup failure.
>
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> drivers/usb/renesas_usbhs/mod_host.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
> index f7ef3a9f82a4..11244cf3408d 100644
> --- a/drivers/usb/renesas_usbhs/mod_host.c
> +++ b/drivers/usb/renesas_usbhs/mod_host.c
> @@ -1441,6 +1441,9 @@ static void usbhsh_pipe_init_for_host(struct usbhs_priv *priv)
> dir_in);
> }
>
> + if (!pipe)
> + return;
No, you just leaked memory and caused the system to be in an unknown
state, which is probably worse off than the crash that would have
happened.
Please fix this properly, if you really have ever hit this before.
thanks,
greg k-h
prev parent reply other threads:[~2026-06-25 13:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 11:45 [PATCH] usb: renesas_usbhs: Check pipe allocation in host pipe init Haoxiang Li
2026-06-25 13:55 ` 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=2026062533-dock-frosting-5a64@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=haoxiang_li2024@163.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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