From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/3] ALSA: usb-audio: Check mixer matrix size for UAC2/3 at parsing
Date: Wed, 30 Sep 2026 17:53:50 +0200 [thread overview]
Message-ID: <20260930155356.348608-2-tiwai@suse.de> (raw)
In-Reply-To: <20260930155356.348608-1-tiwai@suse.de>
The matrix of input/output channels specified in a UAC2/3 mixer unit
must fit to the upper limit 256. Add a sanity check and returns an
error if an invalid size is detected.
Link: https://lore.kernel.org/d46fcac6-bd7e-4fc4-95e1-4e8d39f92ad3@zipdox.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v2->v3: no change
sound/usb/mixer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 33a6a1281410..ddfd7e01a3ef 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2436,6 +2436,16 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,
num_outs = err;
input_pins = desc->bNrInPins;
+ if (state->mixer->protocol == UAC_VERSION_2 ||
+ state->mixer->protocol == UAC_VERSION_3) {
+ if (input_pins * num_outs > 256) {
+ usb_audio_err(state->chip,
+ "invalid channels for MIXER UNIT %d: input=%d, output=%d\n",
+ unitid, input_pins, num_outs);
+ return -EINVAL;
+ }
+ }
+
num_ins = 0;
ich = 0;
for (pin = 0; pin < input_pins; pin++) {
--
2.55.0
next prev parent reply other threads:[~2026-09-30 15:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 15:53 [PATCH v3 0/3] ALSA: usb-audio: fix for UAC2 mixer unit handling Takashi Iwai
2026-09-30 15:53 ` Takashi Iwai [this message]
2026-09-30 15:53 ` [PATCH v3 2/3] ALSA: usb-audio: Fix UAC2 mixer unit request handling Takashi Iwai
2026-09-30 15:53 ` [PATCH v3 3/3] ALSA: usb-audio: Optimize min/max/res parse for UAC2 Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930155356.348608-2-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®