Skip to contentSkip to conversation

dmaengine: ptdma: check for null desc before calling pt_cmd_callback

PATCH Applied Eric Pilmore 2 participants 2 messages Feb 10, 2023 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dmaengine: ptdma: check for null desc before calling pt_cmd_callback

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")

---
v2: clean-up patch format

 drivers/dma/ptdma/ptdma-dmaengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/ptdma/ptdma-dmaengine.c +1 -1
index cc22d162ce25..1aa65e5de0f3 100644
@@ -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);
 }
 
Signature · 1 line
2.38.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Eric Pilmore

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.

Applied, thanks

Signature · 1 line
~Vinod