]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: virtio: Validate control metadata from the device
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Thu, 7 May 2026 14:28:30 +0000 (11:28 -0300)
committerTakashi Iwai <tiwai@suse.de>
Fri, 15 May 2026 09:21:20 +0000 (11:21 +0200)
commitc77a6cbb36ff8cbc1f084d94f8dcda5250935271
tree8589a63bd9f37b4a1655b2474d986521f588d550
parent0cf821727205109ff2119d2bbd45fef8239f7e2c
ALSA: virtio: Validate control metadata from the device

virtio-snd control handling trusts the device-provided control type and
value count returned by the device.

That metadata is then used directly to index g_v2a_type_map[] in
virtsnd_kctl_info(), and to size loops and memcpy() operations in
virtsnd_kctl_get() and virtsnd_kctl_put() against fixed-size
virtio_snd_ctl_value and snd_ctl_elem_value arrays.

A buggy or malicious device can therefore trigger out-of-bounds access by
advertising an invalid control type or an oversized value count.

Validate control type and count once in virtsnd_kctl_parse_cfg(), before
querying enumerated items or exposing the control to ALSA.

Fixes: d6568e3de42d ("ALSA: virtio: add support for audio controls")
Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260507-alsa-virtio-validate-kctl-info-v1-1-7404fb12ec37@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/virtio/virtio_kctl.c