summary refs log tree commit diff
path: root/drivers/dma
diff options
context:
space:
mode:
authorEric Pilmore <epilmore@gigaio.com>2023-02-09 23:51:43 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-10 09:33:39 +0100
commit8ae2113702613207efc05453bc9a3df2b992bf45 (patch)
treebaab54357d7d56bcc3e6397b7b81f0d1e8e0927a /drivers/dma
parentc387ee97aebe898e566a8c945211882dfd3a240d (diff)
downloadlinux-8ae2113702613207efc05453bc9a3df2b992bf45.tar.gz
dmaengine: ptdma: check for null desc before calling pt_cmd_callback
[ Upstream commit 928469986171a6f763b34b039427f5667ba3fd50 ]

Resolves a panic that can occur on AMD systems, typically during host
shutdown, after the PTDMA driver had been exercised. The issue was
the pt_issue_pending() function is mistakenly assuming that there will
be at least one descriptor in the Submitted queue when the function
is called. However, it is possible that both the Submitted and Issued
queues could be empty, which could result in pt_cmd_callback() being
mistakenly called with a NULL pointer.
Ref: Bugzilla Bug 216856.

Fixes: 6fa7e0e836e2 ("dmaengine: ptdma: fix concurrency issue with multiple dma transfer")
Signed-off-by: Eric Pilmore <epilmore@gigaio.com>
Link: https://lore.kernel.org/r/20230210075142.58253-1-epilmore@gigaio.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ptdma/ptdma-dmaengine.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c
index cc22d162ce25..1aa65e5de0f3 100644
--- a/drivers/dma/ptdma/ptdma-dmaengine.c
+++ b/drivers/dma/ptdma/ptdma-dmaengine.c
@@ -254,7 +254,7 @@ static void pt_issue_pending(struct dma_chan *dma_chan)
 	spin_unlock_irqrestore(&chan->vc.lock, flags);
 
 	/* If there was nothing active, start processing */
-	if (engine_is_idle)
+	if (engine_is_idle && desc)
 		pt_cmd_callback(desc, 0);
 }