Commit 6aa60f79 authored by Frank Li's avatar Frank Li Committed by Vinod Koul

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: default avatarFrank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240323-8ulp_edma-v3-2-c0e981027c05@nxp.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent cee8cbfc
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment