From fb4a9779f1267539292268d7363e17180eb4ee5c Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Mon, 17 Sep 2012 11:51:26 +0530 Subject: ALSA: Compress - add codec parameter checks Signed-off-by: Vinod Koul Signed-off-by: Takashi Iwai --- sound/core/compress_offload.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound/core') diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index bd7f28e89254..c40ae573346d 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; } -- cgit v1.2.3