dmaengine Archive mirror
 help / color / mirror / Atom feed
From: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>
To: dmaengine@vger.kernel.org
Cc: Vinod Koul <vkoul@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	 stable@kernel.org, Nuno Sa <nuno.sa@analog.com>
Subject: [PATCH RESEND v3 1/2] dmaengine: axi-dmac: fix possible race in remove()
Date: Thu, 28 Mar 2024 14:58:50 +0100	[thread overview]
Message-ID: <20240328-axi-dmac-devm-probe-v3-1-523c0176df70@analog.com> (raw)
In-Reply-To: <20240328-axi-dmac-devm-probe-v3-0-523c0176df70@analog.com>

From: Nuno Sa <nuno.sa@analog.com>

We need to first free the IRQ before calling of_dma_controller_free().
Otherwise we could get an interrupt and schedule a tasklet while
removing the DMA controller.

Fixes: 0e3b67b348b8 ("dmaengine: Add support for the Analog Devices AXI-DMAC DMA controller")
Cc: stable@kernel.org
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 drivers/dma/dma-axi-dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 4e339c04fc1e..d5a33e4a91b1 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -1134,8 +1134,8 @@ static void axi_dmac_remove(struct platform_device *pdev)
 {
 	struct axi_dmac *dmac = platform_get_drvdata(pdev);
 
-	of_dma_controller_free(pdev->dev.of_node);
 	free_irq(dmac->irq, dmac);
+	of_dma_controller_free(pdev->dev.of_node);
 	tasklet_kill(&dmac->chan.vchan.task);
 	dma_async_device_unregister(&dmac->dma_dev);
 	clk_disable_unprepare(dmac->clk);

-- 
2.44.0



  reply	other threads:[~2024-03-28 13:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 13:58 [PATCH RESEND v3 0/2] dmaengine: axi-dmac: move to device managed probe Nuno Sa via B4 Relay
2024-03-28 13:58 ` Nuno Sa via B4 Relay [this message]
2024-03-28 13:58 ` [PATCH RESEND v3 2/2] " Nuno Sa via B4 Relay
2024-04-07 16:39 ` [PATCH RESEND v3 0/2] " Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2024-02-29 16:23 Nuno Sa
2024-02-29 16:23 ` [PATCH RESEND v3 1/2] dmaengine: axi-dmac: fix possible race in remove() Nuno Sa

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=20240328-axi-dmac-devm-probe-v3-1-523c0176df70@analog.com \
    --to=devnull+nuno.sa.analog.com@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=nuno.sa@analog.com \
    --cc=stable@kernel.org \
    --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 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 read-only IMAP folder(s) and NNTP newsgroup(s).