Skip to content

Commit 81337b9

Browse files
ADESTMvinodkoul
authored andcommitted
dmaengine: stm32-mdma: abort resume if no ongoing transfer
chan->desc can be null, if transfer is terminated when resume is called, leading to a NULL pointer when retrieving the hwdesc. To avoid this case, check that chan->desc is not null and channel is disabled (transfer previously paused or terminated). Fixes: a4ffb13 ("dmaengine: Add STM32 MDMA driver") Signed-off-by: Amelie Delaunay <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 0618c07 commit 81337b9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/dma/stm32-mdma.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,10 @@ static int stm32_mdma_resume(struct dma_chan *c)
12361236
unsigned long flags;
12371237
u32 status, reg;
12381238

1239+
/* Transfer can be terminated */
1240+
if (!chan->desc || (stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & STM32_MDMA_CCR_EN))
1241+
return -EPERM;
1242+
12391243
hwdesc = chan->desc->node[chan->curr_hwdesc].hwdesc;
12401244

12411245
spin_lock_irqsave(&chan->vchan.lock, flags);

0 commit comments

Comments
 (0)