Skip to content

Commit

Permalink
ALSA: snd-usb-caiaq: fix stream count check
Browse files Browse the repository at this point in the history
Commit 897c329 ("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 <[email protected]>
Cc: [email protected] [v3.18+]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
zonque authored and tiwai committed Jan 5, 2015
1 parent 62f64a8 commit 49cdd5b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/usb/caiaq/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 49cdd5b

Please sign in to comment.