]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
dmaengine: xilinx: dpdma: Fix race condition in done IRQ
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 7 Mar 2021 04:06:29 +0000 (06:06 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:54:12 +0000 (09:54 +0200)
BugLink: https://bugs.launchpad.net/bugs/1927535
[ Upstream commit 868833fbffbe51c487df4f95d4de9194264a4b30 ]

The active descriptor pointer is accessed from different contexts,
including different interrupt handlers, and its access must be protected
by the channel's lock. This wasn't done in the done IRQ handler. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20210307040629.29308-3-laurent.pinchart@ideasonboard.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/dma/xilinx/xilinx_dpdma.c

index d504112c609eb13411ca5f76e8215f102c550f0f..70b29bd079c9f30d4a17e294f5ea44acc8eb81f5 100644 (file)
@@ -1048,13 +1048,14 @@ static int xilinx_dpdma_chan_stop(struct xilinx_dpdma_chan *chan)
  */
 static void xilinx_dpdma_chan_done_irq(struct xilinx_dpdma_chan *chan)
 {
-       struct xilinx_dpdma_tx_desc *active = chan->desc.active;
+       struct xilinx_dpdma_tx_desc *active;
        unsigned long flags;
 
        spin_lock_irqsave(&chan->lock, flags);
 
        xilinx_dpdma_debugfs_desc_done_irq(chan);
 
+       active = chan->desc.active;
        if (active)
                vchan_cyclic_callback(&active->vdesc);
        else