[lkml]   [2019]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.9 12/44] ASoC: rt5514-spi: Fix potential NULL pointer dereference
4.9-stable review patch.  If anyone has any objections, please let me know.


From: Gustavo A. R. Silva <>

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")
Signed-off-by: Gustavo A. R. Silva <>
Signed-off-by: Mark Brown <>
Signed-off-by: Greg Kroah-Hartman <>

sound/soc/codecs/rt5514-spi.c | 2 ++
1 file changed, 2 insertions(+)

--- 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 s

rt5514_dsp = devm_kzalloc(platform->dev, sizeof(*rt5514_dsp),
+ if (!rt5514_dsp)
+ return -ENOMEM;

rt5514_dsp->dev = &rt5514_spi->dev;

 \ /
  Last update: 2019-01-29 12:56    [W:0.370 / U:9.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site