diff mbox

ALSA: snd-usb-caiaq: fix stream count check

Message ID 1420397969-12961-1-git-send-email-daniel@zonque.org (mailing list archive)
State Accepted
Commit 49cdd5b641933fda6324fc901eaf856924ba6a27
Headers show

Commit Message

Daniel Mack Jan. 4, 2015, 6:59 p.m. UTC
Commit 897c329bc ("ALSA: usb: caiaq: check for cdev->n_streams > 1")
introduced a safety check to protect against bogus data provided by
devices. However, the n_streams variable is already divided by
CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.

Fix this to un-break support for stereo devices.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Cc: stable@kernel.org [v3.18+]
---
 sound/usb/caiaq/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Takashi Iwai Jan. 5, 2015, 7:57 a.m. UTC | #1
At Sun,  4 Jan 2015 19:59:29 +0100,
Daniel Mack wrote:
> 
> Commit 897c329bc ("ALSA: usb: caiaq: check for cdev->n_streams > 1")
> introduced a safety check to protect against bogus data provided by
> devices. However, the n_streams variable is already divided by
> CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.
> 
> Fix this to un-break support for stereo devices.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> Cc: stable@kernel.org [v3.18+]

Applied, thanks.


Takashi

> ---
>  sound/usb/caiaq/audio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
> index 2728447..327f864 100644
> --- a/sound/usb/caiaq/audio.c
> +++ b/sound/usb/caiaq/audio.c
> @@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
>  		return -EINVAL;
>  	}
>  
> -	if (cdev->n_streams < 2) {
> +	if (cdev->n_streams < 1) {
>  		dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
>  		return -EINVAL;
>  	}
> -- 
> 2.2.0
>
diff mbox

Patch

diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 2728447..327f864 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -816,7 +816,7 @@  int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
 		return -EINVAL;
 	}
 
-	if (cdev->n_streams < 2) {
+	if (cdev->n_streams < 1) {
 		dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
 		return -EINVAL;
 	}