lkml.org 
[lkml]   [2023]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] dmaengine: fsl-edma: Add check for dma_pool_create
Date
Add the check for the return value of the dma_pool_create and return the
error if it fails, in order to avoid NULL pointer dereference in the
fsl_edma_alloc_desc.

Fixes: d6be34fbd39b ("dma: Add Freescale eDMA engine driver support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/dma/fsl-edma-common.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index a06a1575a2a5..a24095c941b6 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -658,6 +658,9 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
sizeof(struct fsl_edma_hw_tcd),
32, 0);
+ if (!fsl_chan->tcd_pool)
+ return -ENOMEM;
+
return 0;
}
EXPORT_SYMBOL_GPL(fsl_edma_alloc_chan_resources);
--
2.25.1
\
 
 \ /
  Last update: 2023-03-27 01:13    [W:0.021 / U:1.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site