[PATCH] usb: renesas_usbhs: Check pipe allocation in host pipe init

From: Haoxiang Li

Date: Mon Jun 22 2026 - 07:46:16 EST


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@xxxxxxx>
---
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;
+
pipe->mod_private = NULL;
}
}
--
2.25.1