]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ALSA: usb-audio: Fix NULL pointer deref in snd_usb_power_domain_set()
authorKarol Kosik <k.kosik@outlook.com>
Thu, 10 Oct 2024 06:59:10 +0000 (23:59 -0700)
committerTakashi Iwai <tiwai@suse.de>
Thu, 10 Oct 2024 11:58:44 +0000 (13:58 +0200)
Commit adding support for multiple control interfaces expanded struct
snd_usb_power_domain with pointer to control interface for proper control
message routing but missed one initialization point of this structure,
which has left new field with NULL value.

Standard mandates that each device has at least one control interface and
code responsible for power domain does not check for NULL values when
querying for control interface. This caused some USB devices to crash
the kernel.

Fixes: 6aa8700150f7 ("ALSA: usb-audio: Support multiple control interfaces")
Signed-off-by: Karol Kosik <k.kosik@outlook.com>
Link: https://patch.msgid.link/AS8P190MB1285B563C6B5394DB274813FEC782@AS8P190MB1285.EURP190.PROD.OUTLOOK.COM
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/stream.c

index d70c140813d6880e1423793a3a9bc44f9ad531bb..c1ea8844a46fc420ee703b8640580cef851ef4b7 100644 (file)
@@ -1067,6 +1067,7 @@ found_clock:
                                        UAC3_BADD_PD_ID10 : UAC3_BADD_PD_ID11;
                pd->pd_d1d0_rec = UAC3_BADD_PD_RECOVER_D1D0;
                pd->pd_d2d0_rec = UAC3_BADD_PD_RECOVER_D2D0;
+               pd->ctrl_iface = ctrl_intf;
 
        } else {
                fp->attributes = parse_uac_endpoint_attributes(chip, alts,