diff options
| author | Chen Ridong <chenridong@huawei.com> | 2024-10-29 08:28:45 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-02 10:32:03 +0100 |
| commit | e658f1c133b854b2ae799147301d82dddb8f3162 (patch) | |
| tree | 9874a14586d7f13b4a065a8736c3d9c560912959 /drivers/dma | |
| parent | aa2381a1ea39f2353e4a81ff0caabee1e2cb3d77 (diff) | |
| download | linux-e658f1c133b854b2ae799147301d82dddb8f3162.tar.gz linux-e658f1c133b854b2ae799147301d82dddb8f3162.tar.bz2 linux-e658f1c133b854b2ae799147301d82dddb8f3162.zip | |
dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset
commit c43ec96e8d34399bd9dab2f2dc316b904892133f upstream.
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: b206d9a23ac7 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/dma')
| -rw-r--r-- | drivers/dma/at_xdmac.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index c3b37168b21f..2d1ee284998e 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1363,6 +1363,8 @@ at_xdmac_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value, return NULL; desc = at_xdmac_memset_create_desc(chan, atchan, dest, len, value); + if (!desc) + return NULL; list_add_tail(&desc->desc_node, &desc->descs_list); desc->tx_dma_desc.cookie = -EBUSY; |
