mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
dmaengine: stm32-mdma: abort resume if no ongoing transfer
commit81337b9a72upstream. 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:a4ffb13c89("dmaengine: Add STM32 MDMA driver") Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20231004163531.2864160-1-amelie.delaunay@foss.st.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0796c53424
commit
8e7dfe9c2a
@@ -1237,6 +1237,10 @@ static int stm32_mdma_resume(struct dma_chan *c)
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 status, reg;
|
u32 status, reg;
|
||||||
|
|
||||||
|
/* Transfer can be terminated */
|
||||||
|
if (!chan->desc || (stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & STM32_MDMA_CCR_EN))
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
hwdesc = chan->desc->node[chan->curr_hwdesc].hwdesc;
|
hwdesc = chan->desc->node[chan->curr_hwdesc].hwdesc;
|
||||||
|
|
||||||
spin_lock_irqsave(&chan->vchan.lock, flags);
|
spin_lock_irqsave(&chan->vchan.lock, flags);
|
||||||
|
|||||||
Reference in New Issue
Block a user