Re: [PATCH] usb: cdns3: gadget: fix NULL pointer dereference in ep_queue
From: Greg Kroah-Hartman
Date: Sat Mar 28 2026 - 12:03:50 EST
On Sat, Mar 28, 2026 at 10:38:42PM +0800, yongchao.wu wrote:
> 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.
>
> Signed-off-by: yongchao.wu <yongchao.wu@xxxxxxxxxxxxx>
Please use your name, not your email alias, for the From: and
signed-off-by lines.
thanks,
greg k-h