KernelScan.io

HIGH Introduced in 5.18

usb-gadget UAC RateList Overflow

CVE-2026-93122

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.8MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: uac: validate rate list length before storing UAC1 and UAC2 configfs rate-list attributes parse a comma-separated list of sampling rates and store each parsed value in fixed-size arrays. The arrays have UAC_MAX_RATES entries, but the store paths do not check that the input contains at most that many tokens before writing through opts->name##s[i++]. Writing more than ten rates therefore writes past the end of the p_srates[] or c_srates[] array in struct f_uac1_opts or struct f_uac2_opts. With CONFIG_UBSAN_BOUNDS enabled, writing an 11-entry rate list to the UAC1 p_srate attribute reports: UBSAN: array-index-out-of-bounds drivers/usb/gadget/function/f_uac1.c:1669:1 index 10 is out of range for type 'int [10]' __ubsan_handle_out_of_bounds.cold f_uac1_opts_p_srate_store configfs_write_iter vfs_write ksys_write do_syscall_64 The same reproducer against the UAC2 p_srate attribute reports: UBSAN: array-index-out-of-bounds drivers/usb/gadget/function/f_uac2.c:2087:1 index 10 is out of range for type 'int [10]' __ubsan_handle_out_of_bounds.cold f_uac2_opts_p_srate_store configfs_write_iter vfs_write ksys_write do_syscall_64 Reject additional tokens once UAC_MAX_RATES entries have been parsed. Also keep the original kstrdup() pointer for kfree(), because strsep() advances the parsing cursor. Freeing the advanced cursor leaks the original buffer on successful parses and can free an interior pointer on some error paths.

02

Engine v0.6.0

Risk summary

The USB audio gadget's configfs rate-list attributes accept an unlimited number of comma-separated sampling rates but store them into fixed-size ten-entry arrays, so a longer list writes past the end of the array and corrupts adjacent kernel heap memory. Only a privileged local user who can write to the gadget's configfs configuration can trigger it, but the written values are fully attacker-controlled, making memory corruption and potential privilege escalation to kernel code execution possible. Devices that do not use the USB audio gadget functions are not affected.

Affecteddrivers/usb/gadget/function/f_uac1.c, drivers/usb/gadget/function/f_uac2.c (USB gadget UAC1/UAC2 audio configfs attributes)

Vulnerability analysis

When the USB audio gadget (UAC1 or UAC2) is being configured through configfs, the attribute that sets the list of supported sampling rates parses a comma-separated list of numbers and writes each one into a fixed-size array that holds at most ten entries. The parsing loop never counted how many entries it had already stored, so supplying a list with more than ten rates kept writing numbers past the end of the array, corrupting whatever kernel data followed it in memory with attacker-chosen 32-bit values. The fix makes the parser reject any list longer than the array can hold, and also corrects the cleanup of the temporary parsing buffer so it is neither leaked nor partially freed. The vulnerable path is reachable only from the local configuration interface for USB gadget functions, which requires administrator privileges to mount and write; it is not reachable over the USB bus itself or from the network, and it only exists on systems where the USB audio gadget function is compiled in or loaded.

03

BranchIntroducedFixed inPatch commit
mainline5.187.3-rc1844d83d5964b
7.25.187.2.63819c6f255a3