mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
dmaengine: dw-axi-dmac: fix null dereference when pointer first is null
[ Upstream commit0788611c9a] In the unlikely event that axi_desc_get returns a null desc in the very first iteration of the while-loop the error exit path ends up calling axi_desc_put on a null pointer 'first' and this causes a null pointer dereference. Fix this by adding a null check on pointer 'first' before calling axi_desc_put. Addresses-Coverity: ("Explicit null dereference") Fixes:1fe20f1b84("dmaengine: Introduce DW AXI DMAC driver") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4c21b761b4
commit
e478abd4eb
|
|
@ -512,7 +512,8 @@ dma_chan_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst_adr,
|
|||
return vchan_tx_prep(&chan->vc, &first->vd, flags);
|
||||
|
||||
err_desc_get:
|
||||
axi_desc_put(first);
|
||||
if (first)
|
||||
axi_desc_put(first);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user