ALSA: control: Don't add invalid kcontrols to LED layer
Subsystems (2)
PATCH 1/1 ALSA: control: Don't add invalid kcontrols to LED layer
From: Takashi Iwai <[email protected]>
[ Upstream commit 74e3b979ce8b78a690f8b94ccf2e2c965f7f5c11 ]
The kcontrol LED state layer tries to track the all associated kcontrol elements with naive assumptions that they are readable. But one can create a write-only element that has no get callback (even a user element can do it), and this may lead to a NULL dereference at the call chain of snd_ctl_led_notify(), as found by syzkaller.
For avoiding the Oops, add a sanity check of the kcontrol's info and get callbacks, and just skip the invalid kcontrols before assigning the kctl to the LED layer.
[ Backport to 6.6.y: After the target's locked control lookup, reject
missing info/get callbacks via the existing unlock label so controls_rwsem and the card reference are released. ]
---
Hi,
Please consider this backport of the fix for CVE-2026-90060 to 6.6.y.
The code changes are identical to upstream, except missing-callback failure uses the target unlock label; see the bracketed backport note above.
The complete fix is already present in 6.12.y, 6.18.y and 7.2.y.
Build-tested only as part of a cumulative 6.6.y series: x86_64 objects (allmodconfig, CONFIG_WERROR=y); no runtime testing.
Thanks,
Artem Dinaburg
sound/core/control_led.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/control_led.c +4 -0
@@ -253,6 +253,10 @@ static int snd_ctl_led_set_id(int card_number, struct snd_ctl_elem_id *id,down_write (&card->controls_rwsem); kctl =snd_ctl_find_id_locked (card, id);if (kctl) { +if (!kctl->info || !kctl->get) { + err = -EINVAL ; + goto unlock; + } ioff =snd_ctl_get_ioff (kctl, id); vd = &kctl->vd[ioff]; access = vd->access &SNDRV_CTL_ELEM_ACCESS_LED_MASK ;
Quoted 3 lines
The kcontrol LED state layer tries to track the all associated kcontrol elements with naive assumptions that they are readable. But one can create a write-only element that has no get callback (even
Queued for 6.6, thanks.
Signature · 2 lines
Thanks, Sasha