| Age | Commit message (Collapse) | Author |
|
client lifecycle (#265)
PR #262 introduced per-instance UX_HOST_CLASS_HID_CLIENT allocation in
client_search.c. However, keyboard/mouse/remote_control activate handlers
already embed a UX_HOST_CLASS_HID_CLIENT inside their own combined
allocation (e.g. UX_HOST_CLASS_HID_CLIENT_KEYBOARD), override
hid->hid_client with the embedded copy, and then free the entire combined
struct (as 'keyboard_instance', the first field) during deactivation.
This created two bugs:
1. Memory leak: the per-instance copy from client_search was abandoned
when activate handlers replaced hid->hid_client with their embedded
copy.
2. Double-free / UX_MEMORY_CORRUPTED: deactivate.c freed hid->hid_client
after calling the handler, but for keyboard/mouse/remote_control the
deactivate handler had already freed the entire combined allocation
(which contains the embedded hid_client), causing a second free of a
pointer into the middle of a now-freed block.
Fix:
- keyboard/mouse/remote_control activate: free the per-instance copy from
client_search before overriding hid->hid_client with the embedded one.
- keyboard/mouse/remote_control deactivate: null hid->hid_client after
freeing the combined struct, signalling that cleanup is done.
- deactivate.c: re-check hid_client != NULL after calling the handler
before freeing; keyboard/mouse/remote_control will have nulled it,
simple clients will not.
- keyboard/mouse ACTIVATE_WAIT error paths (standalone): null
hid->hid_client after freeing the combined struct so that the generic
cleanup in entry.c skips the already-freed pointer.
- entry.c standalone ACTIVATE_WAIT error: guard the free with a NULL
check to safely handle both cases.
Discovered while investigating test failures introduced by PR #262.
All 430 tests pass after this fix.
Co-authored-by: Copilot <[email protected]>
|
|
* fix(hid): Store client instance per-device instead of per-class
* Address review feedback on per-instance HID client copy
Three issues fixed, discovered during maintainer review:
1. Memory leak in standalone activation error path (entry.c):
_ux_host_class_hid_client_activate_wait() set hid_client to NULL
without freeing the per-instance copy allocated in client_search.
The HID_ENUM_ERROR handler destroys the hid struct without freeing
hid_client, so the copy was leaked on every standalone activation
failure. Fixed by freeing hid_client before clearing it.
2. Variable declared inside if-block (client_search.c):
hid_client_instance was declared inside the if (status == UX_SUCCESS)
block, which is a C99 feature. USBX targets C89/C90 embedded
toolchains. Moved to the top of the function with other locals.
3. Trailing whitespace throughout both changed files:
The PR introduced trailing spaces on most comment-block lines.
Reverted all affected lines to their original whitespace.
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Frédéric Desbiens <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
|
Two issues discovered while reviewing and fixing thread-safety issues in
the new ux_host_class_hid_protocol_get/set functions (PR #244).
1. idle_get.c: wrong operator acquires no lock in standalone mode
Line 104 used '&= ~UX_HOST_CLASS_HID_FLAG_LOCK' (the release/clear
operation) instead of '|= UX_HOST_CLASS_HID_FLAG_LOCK' (acquire/set).
The preceding check correctly returns UX_BUSY when the flag is set,
but the follow-on line then immediately clears it instead of setting it.
The net effect is that the HID instance is never actually locked in
UX_HOST_STANDALONE mode, making the mutual-exclusion check a no-op.
2. idle_set.c: standalone path used a blocking spin-loop
The standalone branch called _ux_host_class_hid_idle_set_run() in a
do/while loop, blocking the caller until the transfer completed. This
is inconsistent with every other inline HID control-transfer function
(idle_get, report_get, report_set, protocol_get, protocol_set) which
all use the direct UX_DISABLE/UX_RESTORE atomic flag pattern and
return UX_BUSY if the instance or device endpoint is already locked.
Replaced with the same inline standalone locking pattern used by the
other functions: atomic HID FLAG_LOCK acquire, atomic DEVICE_FLAG_LOCK
acquire with AUTO_DEVICE_UNLOCK + UX_TRANSFER_STATE_RESET, and an
AUTO_WAIT check at completion consistent with idle_get behavior.
Co-authored-by: Copilot <[email protected]>
|
|
get/set API (#244)
This pull request adds host-side HID API functions to get and set the HID protocol (boot vs. report mode), and introduces an optional device-sidecallback invoked when the protocol changes.
New features
- Added host-side APIs ux_host_class_hid_protocol_set() and ux_host_class_hid_protocol_get() with error-checking wrappers (_uxe_ variants).
- Added optional device-side callback ux_device_class_hid_set_protocol_callback, invoked when the host changes the active protocol.
- Added a comprehensive test to verify the new protocol callback functionality.
Bug fixes (host-side protocol get/set)
1. DMA buffer safety (protocol_get): The received byte is now written into a cache-safe allocated buffer instead of the caller's USHORT* directly. Stack memory is not DMA-safe on cache-incoherent embedded targets, and writing 1 byte into a USHORT* yields incorrect results on big-endianplatforms. Follows the same pattern as ux_host_class_hid_idle_get.
2. Missing device protection semaphore (both functions): In RTOS mode, ux_device_protection_semaphore is now acquired before submitting the transfer, in addition to the HID instance semaphore. All other HID control transfer functions (idle_get, idle_set) take both semaphores; omitting it allowed concurrent callers to corrupt the shared transfer_request fields.
3. Missing standalone locking (both functions): Added proper UX_HOST_STANDALONE support using UX_DISABLE/UX_RESTORE to atomically check and setUX_HOST_CLASS_HID_FLAG_LOCK and UX_DEVICE_FLAG_LOCK, and set UX_TRANSFER_FLAG_AUTO_DEVICE_UNLOCK + UX_TRANSFER_STATE_RESET on the transfer request before initiating. Follows the idle_get inline standalone pattern.
Co-authored-by: Frédéric Desbiens <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
|
Add preprocessor guards to allow customization of default line coding parameters.
Summary of Changes:
- Wrapped default line coding constants (RATE, STOP_BIT, PARITY, DATA_BIT)
with #ifndef guards in CDC ACM, GSER, and Prolific host class headers
- This allows users to define custom default values before including these headers in (ux_user.h)
- Updated Prolific activation code to use DEFAULT constants instead of hardcoded values
for consistency and better maintainability
Files Modified:
- common/usbx_host_classes/inc/ux_host_class_cdc_acm.h
- common/usbx_host_classes/inc/ux_host_class_gser.h
- common/usbx_host_classes/inc/ux_host_class_prolific.h
- common/usbx_host_classes/src/ux_host_class_prolific_activate.c
|
|
ux_host_class_hid_report_item_analyse
|
|
|
|
Improved code to leverage the ux internal macros instead of using direct tx struct fields
|
|
|
|
If the queue is empty we need the check here.
|
|
fix (host/storage): prevent stack overflow from infinite partition recursion
|
|
|
|
|
|
- Add a partition entry counter (ux_host_class_storage_mounted_partitions_count)
and a configurable maximum (UX_HOST_CLASS_STORAGE_MAX_PARTITIONS_COUNT) to limit
the number of partition entries processed during mounting.
- Counter is incremented for every partition entry, and checked both before and during the partition parsing loop.
- If the limit is exceeded, the function aborts and returns UX_HOST_CLASS_STORAGE_ERROR_MEDIA_NOT_READ.
- This prevents stack overflow and infinite recursion in case of malformed or cyclic MBR/EBR partition tables.
- Default partition entry limit set to 8 by default for safety and compatibility with typical devices.
Fixes CVE-2025-55095
Signed-off-by: Haithem Rahmani <[email protected]>
|
|
|
|
|
|
Add bounds check for sampling frequency in audio descriptor parsing
|
|
add bounds checks for sampling frequency type to identify the right alternate setting
|
|
add bounds check for frequency array in audio streaming interface descriptor
|
|
Add bounds check for HID report item parsing
|
|
|
|
|
|
alternate setting
|
|
|
|
|
|
|
|
|
|
52c60057 Update headers and readme for 6.3.0 release.
5360ad52 Host H264 frame support.
4b097e80 Add javascript to codeql detection
70278ae3 Fixed use after free issues.
5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im...
39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence.
be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570)
c2368eb2 Improved AC AS management and error handing.
b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal.
34ca3af9 Removed interface link in class linked to device.
5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor...
71b08ad1 Improved host audio descriptors validation
4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration
ca408b54 Checked XML tag nesting depth in Pictbridge object parsing
c300a00c Limited pictbridge array element to hexa output array size.
0e644aaa Reject fake CDC-ECM data interface not located next to its control interface.
911007a9 Improved host HID usage handling.
d0576877 Enable dummy check of python for CodeQL
2761e105 Fixed some split transfer issue.
db0dbeda Added packet length validation for received nx packet.
f5007249 Fix PIMA issues on data set extraction
3ec66399 Fixing device RNDIS bugs with zero copy
1ec77d6b Fix device HID issue when adding class memory man and zero copy.
d52e55c0 Add zero copy support in device printer
a5cb883f Added zero copy support in device CDC_ECM and RNDIS
1f967ae2 Enable codeql in onebranch pipeline
de265dbc Enable zero copy for device audio and video
53aee275 Refined memory management to reduce overhead.
|
|
8b59a1d4 Add support for Get String requests with 0 wIndex
106c1b06 Update cfs usage
2d45d315 Optimize SRAM for extracted USB descriptors
cf97e6e9 Fixed allocated buffer pointer checking issue.
6468c588 Guard basic types.
60b3a232 Update CFS usage
|
|
f6854286 USBX host video error checking support.
909e7523 Onboard to Central Feed Services
863cc0c9 Add optional error check for host storage (no FileX).
0e88a565 Added new test case for HID descriptor get.
03944f4e Add error checking to device/host stack and system.
5bec9ee8 Device PIMA error check improvement. Fixing pictbridge issues (client callbacks initialize, host device info buffer length increase).
f8c89ae9 Added host printer error checking.
|
|
35e477cd Fixed error checking issues on device printer class.
7bc1a9b5 USBX device video error checking support.
fb766837 Moved build option check to runtime (device HID, storage).
3af71cf8 Add optional error checking to host HIDs
e6d938ad generate usbx cmsis-pack
62c0c282 Add error checking to host serial classes (CDC ACM, GSER, PROLIFIC and SWAR)
89b8890b USBX device DFU error checking support.
4c3c3922 USBX device CCID error checking support.
1411aab4 Add error checks for device HID and RNDIS.
2f83bd01 Added host audio error checking.
18973298 USBX device CDC ACM error checking support.
|
|
e180182e Update owners
a6785db8 Update for release.
bc77918b Improve host audio sampling set and check (fixed a memory issue).
97d66e5d Add optimization options to ux_user.h
eea2c732 USBX device printer error checking support.
1760cc8c USBX device audio error checking support
a39f2f26 Fixed a macro name issue in device audio 1.0
83278dd8 Supported multiple report IDs in host HID.
c548fe33 Fixed host CDC-ACM capability get.
b64f8cdb Fix vendor request handling.
|
|
4faab07a Remove internal deprecated files.
d82f44a2 Upgrade to the latest Container Images.
04527692 Checked device removal while reading/writing storage.
d7560786 Add a notice for not released file.
|
|
8ff89b56 Fixed build issue with UX_MAX_DEVICES=1 in host hub standalone
e39131fc Set IPV6 Address before CDC-ECM enumerated.
0b35db7c Fixed build issue with NETX.
b4205710 Added CCID standalone support.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|