All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neel Gandhi <neel.gandhi@xilinx.com>
To: <laurent.pinchart@ideasonboard.com>, <dan.j.williams@intel.com>,
	<vkoul@kernel.org>
Cc: <michal.simek@xilinx.com>, <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Neel Gandhi <neel.gandhi@xilinx.com>
Subject: [PATCH] dmaengine: xilinx: dpdma: Fix race condition in vsync IRQ
Date: Sat, 22 Jan 2022 17:44:07 +0530	[thread overview]
Message-ID: <20220122121407.11467-1-neel.gandhi@xilinx.com> (raw)

Protected race condition of virtual DMA channel from channel queue transfer
via vchan spin lock from the caller of xilinx_dpdma_chan_queue_transfer

Signed-off-by: Neel Gandhi <neel.gandhi@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index b0f4948b00a5..7d77a8948e38 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -1102,7 +1102,9 @@ static void xilinx_dpdma_chan_vsync_irq(struct  xilinx_dpdma_chan *chan)
        chan->desc.active = pending;
        chan->desc.pending = NULL;

+       spin_lock(&chan->vchan.lock);
        xilinx_dpdma_chan_queue_transfer(chan);
+       spin_unlock(&chan->vchan.lock);

 out:
        spin_unlock_irqrestore(&chan->lock, flags);
@@ -1495,7 +1497,9 @@ static void xilinx_dpdma_chan_err_task(struct tasklet_struct *t)
                    XILINX_DPDMA_EINTR_CHAN_ERR_MASK << chan->id);

        spin_lock_irqsave(&chan->lock, flags);
+       spin_lock(&chan->vchan.lock);
        xilinx_dpdma_chan_queue_transfer(chan);
+       spin_unlock(&chan->vchan.lock);
        spin_unlock_irqrestore(&chan->lock, flags);
 }

--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

WARNING: multiple messages have this Message-ID (diff)
From: Neel Gandhi <neel.gandhi@xilinx.com>
To: <laurent.pinchart@ideasonboard.com>, <dan.j.williams@intel.com>,
	<vkoul@kernel.org>
Cc: <michal.simek@xilinx.com>, <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Neel Gandhi <neel.gandhi@xilinx.com>
Subject: [PATCH] dmaengine: xilinx: dpdma: Fix race condition in vsync IRQ
Date: Sat, 22 Jan 2022 17:44:07 +0530	[thread overview]
Message-ID: <20220122121407.11467-1-neel.gandhi@xilinx.com> (raw)

Protected race condition of virtual DMA channel from channel queue transfer
via vchan spin lock from the caller of xilinx_dpdma_chan_queue_transfer

Signed-off-by: Neel Gandhi <neel.gandhi@xilinx.com>
---
 drivers/dma/xilinx/xilinx_dpdma.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index b0f4948b00a5..7d77a8948e38 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -1102,7 +1102,9 @@ static void xilinx_dpdma_chan_vsync_irq(struct  xilinx_dpdma_chan *chan)
        chan->desc.active = pending;
        chan->desc.pending = NULL;

+       spin_lock(&chan->vchan.lock);
        xilinx_dpdma_chan_queue_transfer(chan);
+       spin_unlock(&chan->vchan.lock);

 out:
        spin_unlock_irqrestore(&chan->lock, flags);
@@ -1495,7 +1497,9 @@ static void xilinx_dpdma_chan_err_task(struct tasklet_struct *t)
                    XILINX_DPDMA_EINTR_CHAN_ERR_MASK << chan->id);

        spin_lock_irqsave(&chan->lock, flags);
+       spin_lock(&chan->vchan.lock);
        xilinx_dpdma_chan_queue_transfer(chan);
+       spin_unlock(&chan->vchan.lock);
        spin_unlock_irqrestore(&chan->lock, flags);
 }

--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-01-22 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22 12:14 Neel Gandhi [this message]
2022-01-22 12:14 ` [PATCH] dmaengine: xilinx: dpdma: Fix race condition in vsync IRQ Neel Gandhi
2022-02-03  4:13 ` Laurent Pinchart
2022-02-03  4:13   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220122121407.11467-1-neel.gandhi@xilinx.com \
    --to=neel.gandhi@xilinx.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.