linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: dma: pch_dma.c: Avoid data race between probe and irq handler
@ 2020-04-16  6:23 madhuparnabhowmik10
  2020-04-23  6:19 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: madhuparnabhowmik10 @ 2020-04-16  6:23 UTC (permalink / raw)
  To: dan.j.williams, vkoul
  Cc: dmaengine, linux-kernel, andrianov, ldv-project, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

pd->dma.dev is read in irq handler pd_irq().
However, it is set to pdev->dev after request_irq().
Therefore, set pd->dma.dev to pdev->dev before request_irq() to
avoid data race between pch_dma_probe() and pd_irq().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 drivers/dma/pch_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 581e7a290d98..a3b0b4c56a19 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -865,6 +865,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
 	}
 
 	pci_set_master(pdev);
+	pd->dma.dev = &pdev->dev;
 
 	err = request_irq(pdev->irq, pd_irq, IRQF_SHARED, DRV_NAME, pd);
 	if (err) {
@@ -880,7 +881,6 @@ static int pch_dma_probe(struct pci_dev *pdev,
 		goto err_free_irq;
 	}
 
-	pd->dma.dev = &pdev->dev;
 
 	INIT_LIST_HEAD(&pd->dma.channels);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: dma: pch_dma.c: Avoid data race between probe and irq handler
  2020-04-16  6:23 [PATCH] drivers: dma: pch_dma.c: Avoid data race between probe and irq handler madhuparnabhowmik10
@ 2020-04-23  6:19 ` Vinod Koul
  2020-04-23 18:13   ` Madhuparna Bhowmik
  0 siblings, 1 reply; 3+ messages in thread
From: Vinod Koul @ 2020-04-23  6:19 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: dan.j.williams, dmaengine, linux-kernel, andrianov, ldv-project

On 16-04-20, 11:53, madhuparnabhowmik10@gmail.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> 
> pd->dma.dev is read in irq handler pd_irq().
> However, it is set to pdev->dev after request_irq().
> Therefore, set pd->dma.dev to pdev->dev before request_irq() to
> avoid data race between pch_dma_probe() and pd_irq().

Please use the right subsystem tag for patch. You can find that using
git log on the respective subsystem, in this case it would have told you
that it is dmaengine.

I have fixed that up and applied it, thanks for the patch

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: dma: pch_dma.c: Avoid data race between probe and irq handler
  2020-04-23  6:19 ` Vinod Koul
@ 2020-04-23 18:13   ` Madhuparna Bhowmik
  0 siblings, 0 replies; 3+ messages in thread
From: Madhuparna Bhowmik @ 2020-04-23 18:13 UTC (permalink / raw)
  To: Vinod Koul
  Cc: madhuparnabhowmik10, dan.j.williams, dmaengine, linux-kernel,
	andrianov, ldv-project

On Thu, Apr 23, 2020 at 11:49:35AM +0530, Vinod Koul wrote:
> On 16-04-20, 11:53, madhuparnabhowmik10@gmail.com wrote:
> > From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> > 
> > pd->dma.dev is read in irq handler pd_irq().
> > However, it is set to pdev->dev after request_irq().
> > Therefore, set pd->dma.dev to pdev->dev before request_irq() to
> > avoid data race between pch_dma_probe() and pd_irq().
> 
> Please use the right subsystem tag for patch. You can find that using
> git log on the respective subsystem, in this case it would have told you
> that it is dmaengine.
>
Sure, I will take care of this.

> I have fixed that up and applied it, thanks for the patch
>
Thank you,
Madhuparna
> -- 
> ~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-23 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  6:23 [PATCH] drivers: dma: pch_dma.c: Avoid data race between probe and irq handler madhuparnabhowmik10
2020-04-23  6:19 ` Vinod Koul
2020-04-23 18:13   ` Madhuparna Bhowmik

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