public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, clemens@ladisch.de,
	Nicolai Krakowiak <nicolai.krakowiak@gmail.com>,
	stable@kernel.org
Subject: [PATCH 2/3] ALSA: snd-usb: avoid dividing by zero on invalid input
Date: Thu,  4 Aug 2011 15:56:27 +0200	[thread overview]
Message-ID: <1312466188-3428-3-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1312466188-3428-1-git-send-email-zonque@gmail.com>

From: Nicolai Krakowiak <nicolai.krakowiak@gmail.com>

Signed-off-by: Nicolai Krakowiak <nicolai.krakowiak@gmail.com>
Acked-by: Daniel Mack <zonque@gmail.com>
Cc: stable@kernel.org
---
 sound/usb/mixer.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index d33a5a9..5ab345f 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 {
-- 
1.7.5.4

  parent reply	other threads:[~2011-08-04 13:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 13:56 [PATCH 0/3] 3 Patches for better UAC2 handling Daniel Mack
2011-08-04 13:56 ` [PATCH 1/3] ALSA: snd-usb: Accept UAC2 FORMAT_TYPE descriptors with bLength > 6 Daniel Mack
2011-08-04 14:07   ` Takashi Iwai
2011-08-04 14:15     ` Daniel Mack
2011-08-04 14:17     ` Clemens Ladisch
2011-08-04 14:17       ` Daniel Mack
2011-08-04 14:27         ` Takashi Iwai
2011-08-06  7:26           ` Daniel Mack
2011-08-06  8:22             ` Takashi Iwai
2011-08-06  8:29               ` Daniel Mack
2011-08-04 13:56 ` Daniel Mack [this message]
2011-08-04 13:56 ` [PATCH 3/3] ALSA: snd-usb: operate on given mixer interface only Daniel Mack
2011-08-04 14:11 ` [PATCH 0/3] 3 Patches for better UAC2 handling Clemens Ladisch

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=1312466188-3428-3-git-send-email-zonque@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=nicolai.krakowiak@gmail.com \
    --cc=stable@kernel.org \
    --cc=tiwai@suse.de \
    /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