diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-01-15 20:57:23 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-31 10:12:34 +0300 |
commit | 9b65b52eb689b93f8c7ebe56d082073b8c3d32b4 (patch) | |
tree | 7b77f9f115beedfc2f4e79162324effa033b809f /sound/soc | |
parent | 3d963c98d796f4e065579b234597f838164b8003 (diff) | |
download | linux-9b65b52eb689b93f8c7ebe56d082073b8c3d32b4.tar.xz |
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/soc')
-rw-r--r-- | sound/soc/codecs/rt5514-spi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 09103aab0cb2..7d410e39d1a0 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -253,6 +253,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform) rt5514_dsp = devm_kzalloc(platform->dev, sizeof(*rt5514_dsp), GFP_KERNEL); + if (!rt5514_dsp) + return -ENOMEM; rt5514_dsp->dev = &rt5514_spi->dev; mutex_init(&rt5514_dsp->dma_lock); |