diff options
author | Xiubo Li <Li.Xiubo@freescale.com> | 2014-09-28 17:29:37 +0800 |
---|---|---|
committer | Zefan Li <lizefan@huawei.com> | 2014-12-01 18:02:39 +0800 |
commit | e5b741351f667d05dd8be1a297202682d0cb4969 (patch) | |
tree | 020a27d45c07f48583b14d388187a49b878ab22e | |
parent | 3efcfa5433a7c6ff5e04489398b1d7434f51b733 (diff) |
ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error.
commit 6596aa047b624aeec2ea321962cfdecf9953a383 upstream.
Since we cannot make sure the 'params->num_regs' will always be none
zero here, and then if it equals to zero, the kmemdup() will return
ZERO_SIZE_PTR, which equals to ((void *)16).
So this patch fix this with just doing the zero check before calling
kmemdup().
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r-- | sound/soc/soc-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c88d9741b9e7..34c1fbb5b20b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2799,7 +2799,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, unsigned int val; void *data; - if (!codec->using_regmap) + if (!codec->using_regmap || !params->num_regs) return -EINVAL; data = ucontrol->value.bytes.data; |