summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2026-07-17fix(usbh): bounds-check cur_ep before writing ep[] in ↵HEADmasteryi chen
parse_config_descriptor (#426) * fix(usbh): check cur_ep against CONFIG_USBHOST_MAX_ENDPOINTS before writing ep[] parse_config_descriptor() checks cur_ep_num (the interface descriptor's self-declared bNumEndpoints) against CONFIG_USBHOST_MAX_ENDPOINTS when the INTERFACE descriptor is parsed, but cur_ep (the actual write index, incremented once per ENDPOINT sub-descriptor encountered in the byte stream) is never bounds-checked in the USB_DESCRIPTOR_TYPE_ENDPOINT case before the memcpy. A non-conformant or malicious device can declare a small bNumEndpoints while still emitting more ENDPOINT descriptors than declared in the raw config descriptor byte stream, causing cur_ep to exceed CONFIG_USBHOST_MAX_ENDPOINTS and the memcpy to write past the ep[] array, past altsetting[], and potentially past the whole usbh_configuration struct. Add the same bounds check pattern already used for cur_iface and cur_alt_setting two cases above, applied to cur_ep before the memcpy. * Allow interfaces to use configured capacity Endpoint counts are quantities, so a declaration equal to the endpoint array capacity is valid. The per-index guard still rejects descriptors that contain more endpoint records than the storage can hold. Constraint: Preserve the new cur_ep index guard Confidence: high Scope-risk: narrow Tested: Real parser matrix for declared/actual 3/3, 4/4, 5/5, and 3/5; MinGW and WSL GCC13 ASan+UBSan Not-tested: Physical USB device enumeration
2026-07-14fix(security): check desc len overflowsakumisu
Signed-off-by: sakumisu <[email protected]>
2026-07-12update(security): check null pointer and overflowsakumisu
Signed-off-by: sakumisu <[email protected]>
2026-04-23update(core/usbh_otg): update usbh_initialize paramsakumisu
Signed-off-by: sakumisu <[email protected]>
2026-04-21fix(security): remove hport mutex safelysakumisu
Signed-off-by: sakumisu <[email protected]>
2026-04-17fix(class/hub): remove bus mutex, replace with mq to exit threadsakumisu
Signed-off-by: sakumisu <[email protected]>
2026-04-03fix(core): adjust init&deinit event callback positionsakumisu
Signed-off-by: sakumisu <[email protected]>
2026-03-30fix(core/usbh_core): fix desc length parsesakumisu
2026-02-11refactor: move cherryrb and cherrymp into common dir, rename with ↵sakumisu
usb_ringbuffer and usb_mempool Signed-off-by: sakumisu <[email protected]>
2026-01-24update(demo): remove all old desc apisakumisu
Signed-off-by: sakumisu <[email protected]>
2025-12-22fix(core/otg): fix deinit flag and mode checksakumisu
Signed-off-by: sakumisu <[email protected]>
2025-12-17style: change \t to spacesakumisu
Signed-off-by: sakumisu <[email protected]>
2025-12-03fix(core): fix warningssakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-28update(class/hub): remove hport sources safelysakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-27feat(core/usbh_core): support custom config indexsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-25refactor(otg): refactor otg frameworksakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-24update(core): change assert with USB_ASSERT_MSGsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-20feat(core/usbh_core): support interfacenum match flagsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-13update(core/usbh_core): print interface num when load driversakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-11refactor(core/usbh_core): refactor lsusbsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-11-03update(core/usbh_core): add retry for control transfer, some devices are flakeysakumisu
Signed-off-by: sakumisu <[email protected]>
2025-10-31fix warningsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-10-22feat: support custom ep0 mpssakumisu
Signed-off-by: sakumisu <[email protected]>
2025-08-30feat: host add event callback mechanism similar to deviceEgahp
* fix: fix warning for speed_table * fix(port/dwc2/usb_hc_dwc2): add roothub.speed init * feat(usbh_core): add event_callback * fix(usbh_hub): fix event device reset port * fix(usbh_hub): remove event init when init failed * feat(usbh_core): add default dummy_event_callback * fix(usbh_hub): emit reset event only on successful reset * fix(usbh_core): emit interface start only on successful connect class driver * feat(usbh_core): change event_callback to typedef * feat(port): update port usbh init params * doc: update usbh_initialize desc * fix(usbh_core): check result from ret == 0 change to ret >= 0 --------- Signed-off-by: egahp <[email protected]>
2025-08-27refactor(core/usbh_core): refactor devaddr allocation, use auto incrementsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-08-01update(core/usbh_core): check string support and then get string descsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-27update(core/usbh_core): do not assert when parse desc fail, just return errorsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-25update: add output_len param for usbh_get_string_descsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-20fix(core/usbh_core): change 2ms to 10ms because some platform's tick is ↵sakumisu
100hz then 2ms = 0ms, refs: #342 Signed-off-by: sakumisu <[email protected]>
2025-07-16style: remove some logssakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-13update(core/usbd_core): add ep0 state logsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-05refactor(port/dwc2): support custom config for each dwc2 usb portsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-07-01fix(class/hub): change urb interval unit to ussakumisu
Signed-off-by: sakumisu <[email protected]>
2025-06-03update(core/usbd_core): include dcache & osal headersakumisu
Signed-off-by: sakumisu <[email protected]>
2025-05-27update(core/usbd_core): clear configuration in disconnect callbacksakumisu
Signed-off-by: sakumisu <[email protected]>
2025-05-13fix(core/usbd_core): add check for desc callbacksakumisu
Signed-off-by: sakumisu <[email protected]>
2025-05-10update(port): add sof supportsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-05-06update: add USB_ASSERT_MSG for common casesakumisu
Signed-off-by: sakumisu <[email protected]>
2025-04-30fix unused warningssakumisu
Signed-off-by: sakumisu <[email protected]>
2025-04-21feat(core/usbd_core): add ep0_next_state to record control transfer statesakumisu
Signed-off-by: sakumisu <[email protected]>
2025-03-28fix: fix wformat warningssakumisu
Signed-off-by: sakumisu <[email protected]>
2025-03-28update: add usb align up for every buffer when use dcache clean&invalid apisakumisu
Signed-off-by: sakumisu <[email protected]>
2025-03-04fix(core/usbd_core): fix two bugssakumisu
- fix current_desc_len += p[DESC_bLength] before p+= p[DESC_bLength] - fix reset all eps when alt_setting=0 Signed-off-by: sakumisu <[email protected]>
2025-02-12fix(core/usbd_core): fix return with break in ep0 threadsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-02-09fix(core/usbh_core): check hport is valid in usbh_control_transfersakumisu
Signed-off-by: sakumisu <[email protected]>
2025-02-07fix(core/usbh_core): return valid hport which is connectedsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-02-01feat(core/usbd_core): add ep0 setup handler into thread featuresakumisu
2025-01-25feat(core/usbh_core): add usbh_printf_setup api for debugsakumisu
Signed-off-by: sakumisu <[email protected]>
2025-01-15feat(core/otg): add otg frameworksakumisu
Signed-off-by: sakumisu <[email protected]>
2025-01-15update(port): add ehci/ohci/dwc2 dcache supportsakumisu
Signed-off-by: sakumisu <[email protected]>