Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [git pull] usb-audio: RME Babyface/Fireface fix
Date: Sun, 27 Jan 2013 10:28:29 +0100	[thread overview]
Message-ID: <s5hham3ynya.wl%tiwai@suse.de> (raw)
In-Reply-To: <51040AC1.4080802@ladisch.de>

At Sat, 26 Jan 2013 17:56:33 +0100,
Clemens Ladisch wrote:
> 
> The following change since commit 29594404d7fe73cd80eaa4ee8c43dcc53970c60e:
> 
>   Linux 3.7 (2012-12-10 19:30:57 -0800)
> 
> is available in the git repository at:
> 
>   git://git.alsa-project.org/alsa-kprivate.git usb-audio-fix
> 
> for you to fetch changes up to 5fcbad428a81efa318f15bfcfbcd8f0a98ec0b11:
> 
>   ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices (2013-01-26 17:49:35 +0100)
> 
> ----------------------------------------------------------------
> Clemens Ladisch (1):
>       ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices

Since it's a single commit and it's based on a bit too old tree (3.7),
I cherry-picked it for 3.8 merge.


thanks,

Takashi

> 
>  sound/usb/mixer.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices
> 
> Commit 23caaf19b11e (ALSA: usb-mixer: Add support for Audio Class v2.0)
> forgot to adjust the length check for UAC 2.0 feature unit descriptors.
> This would make the code abort on encountering a feature unit without
> per-channel controls, and thus prevented the driver to work with any
> device having such a unit, such as the RME Babyface or Fireface UCX.
> 
> Reported-by: Florian Hanisch <fhanisch@uni-potsdam.de>
> Tested-by: Matthew Robbetts <wingfeathera@gmail.com>
> Tested-by: Michael Beer <beerml@sigma6audio.de>
> Cc: Daniel Mack <daniel@caiaq.de>
> Cc: 2.6.35+ <stable@vger.kernel.org>
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
> 
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index 298070e..41e8bfb 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -1259,16 +1259,23 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
>  		}
>  		channels = (hdr->bLength - 7) / csize - 1;
>  		bmaControls = hdr->bmaControls;
> +		if (hdr->bLength < 7 + csize) {
> +			snd_printk(KERN_ERR "usbaudio: unit %u: "
> +				   "invalid UAC_FEATURE_UNIT descriptor\n",
> +				   unitid);
> +			return -EINVAL;
> +		}
>  	} else {
>  		struct uac2_feature_unit_descriptor *ftr = _ftr;
>  		csize = 4;
>  		channels = (hdr->bLength - 6) / 4 - 1;
>  		bmaControls = ftr->bmaControls;
> -	}
> -
> -	if (hdr->bLength < 7 || !csize || hdr->bLength < 7 + csize) {
> -		snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid);
> -		return -EINVAL;
> +		if (hdr->bLength < 6 + csize) {
> +			snd_printk(KERN_ERR "usbaudio: unit %u: "
> +				   "invalid UAC_FEATURE_UNIT descriptor\n",
> +				   unitid);
> +			return -EINVAL;
> +		}
>  	}
> 
>  	/* parse the source unit */
> 

      reply	other threads:[~2013-01-27  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26 16:56 [git pull] usb-audio: RME Babyface/Fireface fix Clemens Ladisch
2013-01-27  9:28 ` Takashi Iwai [this message]

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=s5hham3ynya.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.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