Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: usb-audio: Add validation of UAC2/UAC3 effect units

Just add fixed struct size validations for UAC2 and UAC3 effect
units. The descriptor has a variable-length array, so it should be
validated with a proper function later once when the unit is really
parsed and used by the driver (currently only referred partially for
the input terminal parsing).

Link: https://patch.msgid.link/20250821151751.12100-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+7 -2
+7 -2
sound/usb/validate.c
··· 266 266 FUNC(UAC_VERSION_2, UAC_MIXER_UNIT, validate_mixer_unit), 267 267 FUNC(UAC_VERSION_2, UAC_SELECTOR_UNIT, validate_selector_unit), 268 268 FUNC(UAC_VERSION_2, UAC_FEATURE_UNIT, validate_uac2_feature_unit), 269 - /* UAC_VERSION_2, UAC2_EFFECT_UNIT: not implemented yet */ 269 + /* just a stop-gap, it should be a proper function for the array 270 + * once if the unit is really parsed/used 271 + */ 272 + FIXED(UAC_VERSION_2, UAC2_EFFECT_UNIT, 273 + struct uac2_effect_unit_descriptor), 270 274 FUNC(UAC_VERSION_2, UAC2_PROCESSING_UNIT_V2, validate_processing_unit), 271 275 FUNC(UAC_VERSION_2, UAC2_EXTENSION_UNIT_V2, validate_processing_unit), 272 276 FIXED(UAC_VERSION_2, UAC2_CLOCK_SOURCE, ··· 290 286 FUNC(UAC_VERSION_3, UAC3_MIXER_UNIT, validate_mixer_unit), 291 287 FUNC(UAC_VERSION_3, UAC3_SELECTOR_UNIT, validate_selector_unit), 292 288 FUNC(UAC_VERSION_3, UAC3_FEATURE_UNIT, validate_uac3_feature_unit), 293 - /* UAC_VERSION_3, UAC3_EFFECT_UNIT: not implemented yet */ 289 + FIXED(UAC_VERSION_3, UAC3_EFFECT_UNIT, 290 + struct uac2_effect_unit_descriptor), /* sharing the same struct */ 294 291 FUNC(UAC_VERSION_3, UAC3_PROCESSING_UNIT, validate_processing_unit), 295 292 FUNC(UAC_VERSION_3, UAC3_EXTENSION_UNIT, validate_processing_unit), 296 293 FIXED(UAC_VERSION_3, UAC3_CLOCK_SOURCE,