summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@linux.intel.com>2012-09-17 06:21:26 (GMT)
committerTakashi Iwai <tiwai@suse.de>2012-09-17 07:54:50 (GMT)
commitfb4a9779f1267539292268d7363e17180eb4ee5c (patch)
tree960691ff81a94693b2d0e4ff5db1ba8055bd6f0a /sound
parent4dc040a0b34890d2adc0d63da6e9bfb4eb791b19 (diff)
downloadlinux-fb4a9779f1267539292268d7363e17180eb4ee5c.tar.xz
ALSA: Compress - add codec parameter checks
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/compress_offload.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index bd7f28e..c40ae57 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -432,6 +432,16 @@ static int snd_compress_check_input(struct snd_compr_params *params)
params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
return -EINVAL;
+ /* now codec parameters */
+ if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX)
+ return -EINVAL;
+
+ if (params->codec.ch_in == 0 || params->codec.ch_out == 0)
+ return -EINVAL;
+
+ if (!(params->codec.sample_rate & SNDRV_PCM_RATE_8000_192000))
+ return -EINVAL;
+
return 0;
}