summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorGustavo A. R. Silva2019-01-15 18:57:23 +0100
committerGreg Kroah-Hartman2019-01-31 08:14:34 +0100
commit4fedd516d5548aa3841b66b61d75ea4c40e7e08e (patch)
treef358b92d787777b563e9899f09ea5716c0dbbc4b /sound
parentASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages (diff)
downloadkernel-qcow2-linux-4fedd516d5548aa3841b66b61d75ea4c40e7e08e.tar.gz
kernel-qcow2-linux-4fedd516d5548aa3841b66b61d75ea4c40e7e08e.tar.xz
kernel-qcow2-linux-4fedd516d5548aa3841b66b61d75ea4c40e7e08e.zip
ASoC: rt5514-spi: Fix potential NULL pointer dereference
commit 060d0bf491874daece47053c4e1fb0489eb867d2 upstream. There is a potential NULL pointer dereference in case devm_kzalloc() fails and returns NULL. Fix this by adding a NULL check on rt5514_dsp. This issue was detected with the help of Coccinelle. Fixes: 6eebf35b0e4a ("ASoC: rt5514: add rt5514 SPI driver") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5514-spi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 6478d10c4f4a..cdb1f40009ab 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -278,6 +278,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_component *component)
rt5514_dsp = devm_kzalloc(component->dev, sizeof(*rt5514_dsp),
GFP_KERNEL);
+ if (!rt5514_dsp)
+ return -ENOMEM;
rt5514_dsp->dev = &rt5514_spi->dev;
mutex_init(&rt5514_dsp->dma_lock);