Commit 60c961a9 authored by Nicolai Krakowiak's avatar Nicolai Krakowiak Committed by Takashi Iwai

ALSA: snd-usb: avoid dividing by zero on invalid input

Signed-off-by: default avatarNicolai Krakowiak <nicolai.krakowiak@gmail.com>
Acked-by: default avatarDaniel Mack <zonque@gmail.com>
Acked-by: default avatarClemens Ladisch <clemens@ladisch.de>
Cc: stable@kernel.org
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 824818b1
...@@ -1191,6 +1191,11 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void ...@@ -1191,6 +1191,11 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
if (state->mixer->protocol == UAC_VERSION_1) { if (state->mixer->protocol == UAC_VERSION_1) {
csize = hdr->bControlSize; csize = hdr->bControlSize;
if (!csize) {
snd_printdd(KERN_ERR "usbaudio: unit %u: "
"invalid bControlSize == 0\n", unitid);
return -EINVAL;
}
channels = (hdr->bLength - 7) / csize - 1; channels = (hdr->bLength - 7) / csize - 1;
bmaControls = hdr->bmaControls; bmaControls = hdr->bmaControls;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment