[PATCH] usb: gadget: aspeed_udc: validate pointers before dereferencing in ast_udc_ep_enable()
Joe Wang
joe_wang at aspeedtech.com
Wed Dec 2 23:26:47 PST 2026
Hi Takano,
> In ast_udc_ep_enable(), desc and ep are dereferenced in local variable
> initializers (usb_endpoint_maxp(desc), ep->udc, and usb_endpoint_num(desc))
> before checking whether _ep or desc is NULL. In addition, the error path
> calls EP_DBG(ep, ...), which dereferences ep->udc and ep->ep.name when
> AST_EP_DEBUG is enabled.
Thanks for the patch, but I don't think this change is needed.
ast_udc_ep_enable() is only reached through ep->ops->enable(), and the
only caller of that is usb_ep_enable() in udc/core.c. usb_ep_enable()
already dereferences ep (ep->enabled) before the call, and it returns
-EINVAL with a WARN if ep->desc is NULL or its maxpacket is 0, so _ep
and desc can never be NULL by the time ast_udc_ep_enable() runs.
Because of that there is no NULL dereference to fix here, and the
Fixes: tag does not apply.
Thanks,
Joe Wang
More information about the linux-arm-kernel
mailing list