summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorNicolai Krakowiak <nicolai.krakowiak@gmail.com>2011-08-04 15:56:27 +0200
committerTakashi Iwai <tiwai@suse.de>2011-08-04 16:24:06 +0200
commit60c961a9e1ed879a4d151df6076bf1203f595f73 (patch)
tree82737b4c558bf9d494c420434cf24ea9ec184fd0 /sound/usb
parent824818b148db42173446707df4cbd61cd7133272 (diff)
downloadlinux-60c961a9e1ed879a4d151df6076bf1203f595f73.tar.gz
linux-60c961a9e1ed879a4d151df6076bf1203f595f73.tar.bz2
linux-60c961a9e1ed879a4d151df6076bf1203f595f73.zip
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>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c22fa76e363a..ee9aa087d8b5 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1191,6 +1191,11 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
if (state->mixer->protocol == UAC_VERSION_1) {
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;
bmaControls = hdr->bmaControls;
} else {