diff options
author | Zeng Heng <zengheng4@huawei.com> | 2022-11-14 16:56:29 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 09:26:13 +0100 |
commit | 5b510a82740d2a42a75b5661b402bcaf8ae22cd5 (patch) | |
tree | e1bb4e8a209c33331e27423f2f6ac5a7975d7045 /sound/soc | |
parent | 4539e3211a9bd2418e76797718a4e60a7ae34fcf (diff) | |
download | linux-stable-5b510a82740d2a42a75b5661b402bcaf8ae22cd5.tar.gz linux-stable-5b510a82740d2a42a75b5661b402bcaf8ae22cd5.tar.bz2 linux-stable-5b510a82740d2a42a75b5661b402bcaf8ae22cd5.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/soc')
-rw-r--r-- | sound/soc/pxa/mmp-pcm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c index 624d9bd5dadd..609843f607a3 100644 --- a/sound/soc/pxa/mmp-pcm.c +++ b/sound/soc/pxa/mmp-pcm.c @@ -88,7 +88,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; } |