Skip to content

Commit c0fca73

Browse files
lkundrakvinodkoul
authored andcommitted
dmaengine: mmp_tdma: Validate the transfer direction
We only support DMA_DEV_TO_MEM and DMA_MEM_TO_DEV. Let's not do undefined things with other values and reject them. Signed-off-by: Lubomir Rintel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 7edfe3d commit c0fca73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/dma/mmp_tdma.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic(
427427
int num_periods = buf_len / period_len;
428428
int i = 0, buf = 0;
429429

430+
if (!is_slave_direction(direction)) {
431+
dev_err(tdmac->dev, "unsupported transfer direction\n");
432+
return NULL;
433+
}
434+
430435
if (tdmac->status != DMA_COMPLETE) {
431436
dev_err(tdmac->dev, "controller busy");
432437
return NULL;

0 commit comments

Comments
 (0)