summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorZeng Heng <zengheng4@huawei.com>2022-11-14 16:56:29 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-18 11:30:11 +0100
commit0abd1d78317a3a2dfe00b203fbf14ee7df537e0a (patch)
treee6d7cb1d58f59892cce8fae543840cba00ad0401 /sound
parent4760fa67aff6bd8ef0b14c1fa04c295e734c7309 (diff)
downloadlinux-stable-0abd1d78317a3a2dfe00b203fbf14ee7df537e0a.tar.gz
linux-stable-0abd1d78317a3a2dfe00b203fbf14ee7df537e0a.tar.bz2
linux-stable-0abd1d78317a3a2dfe00b203fbf14ee7df537e0a.zip
ASoC: pxa: fix null-pointer dereference in filter()
[ Upstream commit ec7bf231aaa1bdbcb69d23bc50c753c80fb22429 ] kasprintf() would return NULL pointer when kmalloc() fail to allocate. Need to check the return pointer before calling strcmp(). Fixes: 7a824e214e25 ("ASoC: mmp: add audio dma support") Signed-off-by: Zeng Heng <zengheng4@huawei.com> Link: https://lore.kernel.org/r/20221114085629.1910435-1-zengheng4@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/pxa/mmp-pcm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
index d2d4652de32c..5969aa66410d 100644
--- a/sound/soc/pxa/mmp-pcm.c
+++ b/sound/soc/pxa/mmp-pcm.c
@@ -90,7 +90,7 @@ static bool filter(struct dma_chan *chan, void *param)
devname = kasprintf(GFP_KERNEL, "%s.%d", dma_data->dma_res->name,
dma_data->ssp_id);
- if ((strcmp(dev_name(chan->device->dev), devname) == 0) &&
+ if (devname && (strcmp(dev_name(chan->device->dev), devname) == 0) &&
(chan->chan_id == dma_data->dma_res->start)) {
found = true;
}