Skip to content

Commit c43ec96

Browse files
Chen Ridongvinodkoul
authored andcommitted
dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
The at_xdmac_memset_create_desc may return NULL, which will lead to a null pointer dereference. For example, the len input is error, or the atchan->free_descs_list is empty and memory is exhausted. Therefore, add check to avoid this. Fixes: b206d9a ("dmaengine: xdmac: Add memset support") Signed-off-by: Chen Ridong <chenridong@huawei.com> Link: https://lore.kernel.org/r/20241029082845.1185380-1-chenridong@huaweicloud.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 40384c8 commit c43ec96

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/dma/at_xdmac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,8 @@ at_xdmac_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
13631363
return NULL;
13641364

13651365
desc = at_xdmac_memset_create_desc(chan, atchan, dest, len, value);
1366+
if (!desc)
1367+
return NULL;
13661368
list_add_tail(&desc->desc_node, &desc->descs_list);
13671369

13681370
desc->tx_dma_desc.cookie = -EBUSY;

0 commit comments

Comments
 (0)