projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cee8cbf
)
dmaengine: fsl-edma: add safety check for 'srcid'
author
Frank Li
<Frank.Li@nxp.com>
Sat, 23 Mar 2024 15:34:51 +0000
(11:34 -0400)
committer
Vinod Koul
<vkoul@kernel.org>
Sun, 7 Apr 2024 11:50:00 +0000
(17:20 +0530)
Ensure that 'srcid' is a non-zero value to avoid dtb passing invalid
'srcid' to the driver.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link:
https://lore.kernel.org/r/20240323-8ulp_edma-v3-2-c0e981027c05@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/fsl-edma-main.c
patch
|
blob
|
history
diff --git
a/drivers/dma/fsl-edma-main.c
b/drivers/dma/fsl-edma-main.c
index 0a6e0c40402745bf009e515ca45b8e0640ec8004..2148a7f1ae8431122148a44e81c852c735d60b01 100644
(file)
--- a/
drivers/dma/fsl-edma-main.c
+++ b/
drivers/dma/fsl-edma-main.c
@@
-115,6
+115,13
@@
static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
chan->device->privatecnt++;
fsl_chan = to_fsl_edma_chan(chan);
fsl_chan->srcid = dma_spec->args[1];
+
+ if (!fsl_chan->srcid) {
+ dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n",
+ fsl_chan->srcid);
+ return NULL;
+ }
+
fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid,
true);
mutex_unlock(&fsl_edma->fsl_edma_mutex);