summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2020-08-17 14:57:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 20:04:24 +0300
commitcd8c3a766bf286a5e9f4a72ec69e611ae2c88ea6 (patch)
treebfa0bdd0721ca503a2c942ea564973564a7388a8 /drivers/dma
parent3eabc73c4a3ce80559886c9386f132399f0ad8fe (diff)
downloadlinux-cd8c3a766bf286a5e9f4a72ec69e611ae2c88ea6.tar.xz
dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
[ Upstream commit 0cef8e2c5a07d482ec907249dbd6687e8697677f ] The reurn value of of_find_device_by_node() is not checked, thus null pointer dereference will be triggered if of_find_device_by_node() failed. Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding") Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20200817115728.1706719-2-yukuai3@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/at_hdmac.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index dbc51154f122..86427f6ba78c 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1677,6 +1677,8 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
return NULL;
dmac_pdev = of_find_device_by_node(dma_spec->np);
+ if (!dmac_pdev)
+ return NULL;
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);