diff options
| author | Xiaoyu Ye <benyxy@codeaurora.org> | 2017-01-12 13:43:38 -0800 |
|---|---|---|
| committer | Xiaoyu Ye <benyxy@codeaurora.org> | 2017-01-12 18:30:09 -0800 |
| commit | 1af2bc60dac5192532ce707b8b14299d4b121817 (patch) | |
| tree | ccaa6da7eaa96ac5186bbc04a304f7adf4444da8 /drivers/misc | |
| parent | 2dc96b1cbbdcf5aef3780696708012d55fec57f2 (diff) | |
misc: qcom: qdsp6v2: Add range check in function aac_in_ioctl_shared
Add range check for cfg->sample_rate to prevent the user space from
providing an invalid sample rate.
CRs-Fixed: 1108109
Change-Id: I17ccda0901aa4ad84d6e2f78679d71aa327f42eb
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/qcom/qdsp6v2/aac_in.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/misc/qcom/qdsp6v2/aac_in.c b/drivers/misc/qcom/qdsp6v2/aac_in.c index 7176c114f85b..ef963451a3f9 100644 --- a/drivers/misc/qcom/qdsp6v2/aac_in.c +++ b/drivers/misc/qcom/qdsp6v2/aac_in.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2010-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -34,6 +34,8 @@ #define AAC_FORMAT_ADTS 65535 +#define MAX_SAMPLE_RATE_384K 384000 + static long aac_in_ioctl_shared(struct file *file, unsigned int cmd, void *arg) { struct q6audio_in *audio = file->private_data; @@ -233,6 +235,13 @@ static long aac_in_ioctl_shared(struct file *file, unsigned int cmd, void *arg) break; } + if (cfg->sample_rate > MAX_SAMPLE_RATE_384K) { + pr_err("%s: ERROR: invalid sample rate = %u", + __func__, cfg->sample_rate); + rc = -EINVAL; + break; + } + min_bitrate = ((cfg->sample_rate)*(cfg->channels))/2; /* This calculation should be based on AAC mode. But we cannot * get AAC mode in this setconfig. min_bitrate's logical max |
