ALSA: snd-usb: avoid dividing by zero on invalid input
Signed-off-by: Nicolai Krakowiak <nicolai.krakowiak@gmail.com> Acked-by: Daniel Mack <zonque@gmail.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Cc: stable@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
824818b148
commit
60c961a9e1
1 changed files with 5 additions and 0 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue