Skip to content

Commit 585a4fe

Browse files
GustavoARSilvagregkh
authored andcommitted
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: 6eebf35 ("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>
1 parent 27657a6 commit 585a4fe

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sound/soc/codecs/rt5514-spi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform)
265265

266266
rt5514_dsp = devm_kzalloc(platform->dev, sizeof(*rt5514_dsp),
267267
GFP_KERNEL);
268+
if (!rt5514_dsp)
269+
return -ENOMEM;
268270

269271
rt5514_dsp->dev = &rt5514_spi->dev;
270272
mutex_init(&rt5514_dsp->dma_lock);

0 commit comments

Comments
 (0)