Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: cdns3: gadget: fix NULL pointer dereference in ep_queue

When the gadget endpoint is disabled or not yet configured, the ep->desc
pointer can be NULL. This leads to a NULL pointer dereference when
__cdns3_gadget_ep_queue() is called, causing a kernel crash.

Add a check to return -ESHUTDOWN if ep->desc is NULL, which is the
standard return code for unconfigured endpoints.

This prevents potential crashes when ep_queue is called on endpoints
that are not ready.

Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Cc: stable <stable@kernel.org>
Signed-off-by: Yongchao Wu <yongchao.wu@autochips.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://patch.msgid.link/20260331000407.613298-1-yongchao.wu@autochips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Yongchao Wu and committed by
Greg Kroah-Hartman
7f6f127b 0179c6da

+3
+3
drivers/usb/cdns3/cdns3-gadget.c
··· 2589 2589 struct cdns3_request *priv_req; 2590 2590 int ret = 0; 2591 2591 2592 + if (!ep->desc) 2593 + return -ESHUTDOWN; 2594 + 2592 2595 request->actual = 0; 2593 2596 request->status = -EINPROGRESS; 2594 2597 priv_req = to_cdns3_request(request);