* [RESEND PATCH] dmaengine: ptdma: check for null desc before calling pt_cmd_callback
@ 2023-02-10 5:37 Eric Pilmore
2023-02-10 5:55 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Eric Pilmore @ 2023-02-10 5:37 UTC (permalink / raw)
To: Mehta, Sanju, dmaengine, Vinod; +Cc: Eric Pilmore
From: Eric Pilmore <epilmore@gigaio.com>
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>
---
drivers/dma/ptdma/ptdma-dmaengine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] dmaengine: ptdma: check for null desc before calling pt_cmd_callback
2023-02-10 5:37 [RESEND PATCH] dmaengine: ptdma: check for null desc before calling pt_cmd_callback Eric Pilmore
@ 2023-02-10 5:55 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2023-02-10 5:55 UTC (permalink / raw)
To: Eric Pilmore; +Cc: Mehta, Sanju, dmaengine
On 09-02-23, 21:37, Eric Pilmore wrote:
> From: Eric Pilmore <epilmore@gigaio.com>
>
> 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")
This should not be split two two lines!
> Signed-off-by: Eric Pilmore <epilmore@gigaio.com>
> ---
> drivers/dma/ptdma/ptdma-dmaengine.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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)
Please run checkpatch before sending patches
WARNING: please, no spaces at the start of a line
#40: FILE: drivers/dma/ptdma/ptdma-dmaengine.c:257:
+ if (engine_is_idle && desc)$
WARNING: suspect code indent for conditional statements (7, 15)
#40: FILE: drivers/dma/ptdma/ptdma-dmaengine.c:257:
+ if (engine_is_idle && desc)
pt_cmd_callback(desc, 0);
> pt_cmd_callback(desc, 0);
> }
>
> --
> 2.38.1
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-10 5:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 5:37 [RESEND PATCH] dmaengine: ptdma: check for null desc before calling pt_cmd_callback Eric Pilmore
2023-02-10 5:55 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).