[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200817115728.1706719-2-yukuai3@huawei.com>
Date: Mon, 17 Aug 2020 19:57:26 +0800
From: Yu Kuai <yukuai3@...wei.com>
To: <ludovic.desroches@...rochip.com>, <tudor.ambarus@...rochip.com>,
<vkoul@...nel.org>, <dan.j.williams@...el.com>,
<nicolas.ferre@...rochip.com>, <plagnioj@...osoft.com>,
<arnd@...db.de>
CC: <linux-arm-kernel@...ts.infradead.org>,
<dmaengine@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<yi.zhang@...wei.com>, <yukuai3@...wei.com>
Subject: [PATCH 1/3] dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
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@...wei.com>
---
drivers/dma/at_hdmac.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 45bbcd6146fd..1c941f839c42 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1650,6 +1650,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);
--
2.25.4
Powered by blists - more mailing lists