The MAX32xxx USB device controller driver (drivers/usb/udc/udc_max32.c, compatible adi_max32_usbhs) dereferenced an endpoint buffer in its OUT and IN transfer-completion handlers without checking it for NULL. udc_event_xfer_out_done() called net_buf_add(buf, ep_request->actlen) immediately after buf = udc_buf_get(ep_cfg), where udc_buf_get() returns NULL when the endpoint FIFO is empty.
A transfer-completion event is queued from interrupt context and processed asynchronously by the driver thread; between queuing and processing, the endpoint FIFO can be drained by host-controlled control flow — in particular udc_setup_received() drains the EP0 OUT/IN FIFOs whenever a new SETUP packet arrives, and dequeue/disable/purge paths drain it likewise.
A USB host that aborts an in-flight EP0 control transfer with a new SETUP packet (legal USB behavior) can therefore cause a stale XFER_OUT_DONE event to be processed against an empty FIFO, producing net_buf_add(NULL, ...), a near-NULL pointer dereference that faults and crashes the device. No authentication is required; the attacker is the USB host the device is connected to (physical bus access). Impact is denial of service (device crash).
The defect was introduced when the MAX32 UDC driver was added and shipped in Zephyr v4.4.0. The fix adds NULL-buffer checks that return early with UDC_EVT_ERROR/-ENOBUFS in both the OUT-done and IN-done handlers.
Affected components
drivers/usb/udc/udc_max32.c
Affected versions
v4.4.0 (MAX32 UDC driver, adi_max32_usbhs)
Fix
Fixed (merged) in a0d8f78
Projected fixed version: 4.5.0 (the fix is merged on main but not yet released; this forecast should be confirmed against the actual release).
Introduced by: 65883ed (drivers: udc: Add MAX32xxx UDC driver, 2025-04-09); shipped in v4.4.0
Evidence
- drivers/usb/udc/udc_max32.c:242-249 — post-fix udc_event_xfer_out_done adds NULL check before net_buf_add(buf, actlen); pre-fix (git show ^) called net_buf_add on the unchecked buf
- drivers/usb/udc/udc_common.c:79-82 — udc_buf_get is k_fifo_get(..., K_NO_WAIT), returns NULL on empty FIFO
- lib/net_buf/buf_simple.c net_buf_simple_add — does buf->len += len, dereferencing near-NULL when buf is NULL
- drivers/usb/udc/udc_common.c:118-143 — udc_setup_received drains EP0 OUT/IN FIFOs on a new SETUP packet (host-controlled), the FIFO-drain that races the queued completion event
- drivers/usb/udc/udc_max32.c:296-327 — thread handler dispatches independent msgq events (SETUP vs XFER_OUT_DONE) whose order follows host/IRQ timing
- drivers/usb/udc/udc_max32.c:84-93 — OUT-done ISR callback queues XFER_OUT_DONE without holding any buffer reference
- git: file added by 65883ed (2025-04-09) and present in v4.4.0 tag — vulnerable code shipped
Patches
For more information
If you have any questions or comments about this advisory:
embargo: 2026-07-05
The MAX32xxx USB device controller driver (
drivers/usb/udc/udc_max32.c, compatibleadi_max32_usbhs) dereferenced an endpoint buffer in its OUT and IN transfer-completion handlers without checking it forNULL.udc_event_xfer_out_done()callednet_buf_add(buf, ep_request->actlen)immediately afterbuf = udc_buf_get(ep_cfg), whereudc_buf_get()returnsNULLwhen the endpoint FIFO is empty.A transfer-completion event is queued from interrupt context and processed asynchronously by the driver thread; between queuing and processing, the endpoint FIFO can be drained by host-controlled control flow — in particular
udc_setup_received()drains the EP0 OUT/IN FIFOs whenever a new SETUP packet arrives, and dequeue/disable/purge paths drain it likewise.A USB host that aborts an in-flight EP0 control transfer with a new SETUP packet (legal USB behavior) can therefore cause a stale
XFER_OUT_DONEevent to be processed against an empty FIFO, producingnet_buf_add(NULL, ...), a near-NULL pointer dereference that faults and crashes the device. No authentication is required; the attacker is the USB host the device is connected to (physical bus access). Impact is denial of service (device crash).The defect was introduced when the MAX32 UDC driver was added and shipped in Zephyr v4.4.0. The fix adds NULL-buffer checks that return early with
UDC_EVT_ERROR/-ENOBUFS in both the OUT-done and IN-done handlers.Affected components
drivers/usb/udc/udc_max32.cAffected versions
v4.4.0 (MAX32 UDC driver, adi_max32_usbhs)
Fix
Fixed (merged) in a0d8f78
Projected fixed version: 4.5.0 (the fix is merged on
mainbut not yet released; this forecast should be confirmed against the actual release).Introduced by: 65883ed (drivers: udc: Add MAX32xxx UDC driver, 2025-04-09); shipped in v4.4.0
Evidence
Patches
mainv4.4-branchv4.3-branchFor more information
If you have any questions or comments about this advisory:
embargo: 2026-07-05