Skip to content

Commit 6aa60f7

Browse files
nxpfranklivinodkoul
authored andcommitted
dmaengine: fsl-edma: add safety check for 'srcid'
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>
1 parent cee8cbf commit 6aa60f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/dma/fsl-edma-main.c

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
115115
chan->device->privatecnt++;
116116
fsl_chan = to_fsl_edma_chan(chan);
117117
fsl_chan->srcid = dma_spec->args[1];
118+
119+
if (!fsl_chan->srcid) {
120+
dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n",
121+
fsl_chan->srcid);
122+
return NULL;
123+
}
124+
118125
fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid,
119126
true);
120127
mutex_unlock(&fsl_edma->fsl_edma_mutex);

0 commit comments

Comments
 (0)