dmaengine: ptdma: check for null desc before calling pt_cmd_callback

Bugzilla: https://bugzilla.redhat.com/2181355
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit 928469986171a6f763b34b039427f5667ba3fd50
Author: Eric Pilmore <epilmore@gigaio.com>
Date:   Thu Feb 9 23:51:43 2023 -0800

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

(cherry picked from commit 928469986171a6f763b34b039427f5667ba3fd50)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
This commit is contained in:
Jerry Snitselaar 2023-03-11 18:19:46 -07:00
parent dff8a32e3e
commit 7a0f43e631
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}