Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Fix NULL pointer deref in snd_usb_power_domain_set()
@ 2024-10-10  6:59 Karol Kosik
  2024-10-10 12:02 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Karol Kosik @ 2024-10-10  6:59 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Karol Kosik, Jaroslav Kysela, Johan Carlsson, linux-sound,
	linux-kernel

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>
---
 sound/usb/stream.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index d70c140813d6..c1ea8844a46f 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1067,6 +1067,7 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
                                        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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-10 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10  6:59 [PATCH] ALSA: usb-audio: Fix NULL pointer deref in snd_usb_power_domain_set() Karol Kosik
2024-10-10 12:02 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox