From: Jiale Yao <yaojiale02@163.com>
To: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Lennert Buytenhek <buytenh@marvell.com>,
Maciej Sosnowski <maciej.sosnowski@intel.com>,
Nicolas Pitre <nico@marvell.com>, Dan Williams <djbw@kernel.org>,
Saeed Bishara <saeed@marvell.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH 5/7] dmaengine: mv_xor: drain IRQ tasklet before freeing channel memory
Date: Sun, 18 Oct 2026 12:07:21 +0800 [thread overview]
Message-ID: <20261018040724.534641-6-yaojiale02@163.com> (raw)
In-Reply-To: <20261018040724.534641-1-yaojiale02@163.com>
The XOR interrupt handler schedules irq_tasklet to clean channel
descriptor lists. Both device removal and late channel setup failures
can free the coherent descriptor pool while a previously queued tasklet
still refers to it.
Release the IRQ first so no new tasklet can be queued, kill the tasklet,
and only then free the descriptor pool and DMA mappings.
Fixes: ff7b04796d98 ("dmaengine: DMA engine driver for Marvell XOR engine")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/dma/mv_xor.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 25ed61f1b089..ec746cd16960 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1013,6 +1013,9 @@ static int mv_xor_channel_remove(struct mv_xor_chan *mv_chan)
dma_async_device_unregister(&mv_chan->dmadev);
+ free_irq(mv_chan->irq, mv_chan);
+ tasklet_kill(&mv_chan->irq_tasklet);
+
dma_free_wc(dev, MV_XOR_POOL_SIZE,
mv_chan->dma_desc_pool_virt, mv_chan->dma_desc_pool);
dma_unmap_single(dev, mv_chan->dummy_src_addr,
@@ -1025,8 +1028,6 @@ static int mv_xor_channel_remove(struct mv_xor_chan *mv_chan)
list_del(&chan->device_node);
}
- free_irq(mv_chan->irq, mv_chan);
-
return 0;
}
@@ -1162,6 +1163,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
err_free_irq:
free_irq(mv_chan->irq, mv_chan);
+ tasklet_kill(&mv_chan->irq_tasklet);
err_free_dma:
dma_free_wc(&pdev->dev, MV_XOR_POOL_SIZE,
mv_chan->dma_desc_pool_virt, mv_chan->dma_desc_pool);
--
2.34.1
next prev parent reply other threads:[~2026-10-18 4:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 4:07 [PATCH 0/7] dmaengine: drain completion tasklets during teardown Jiale Yao
2026-10-18 4:07 ` [PATCH 1/7] dmaengine: ep93xx: drain tasklet before freeing channel resources Jiale Yao
2026-10-18 4:07 ` [PATCH 2/7] dmaengine: fsldma: drain channel tasklet during removal Jiale Yao
2026-10-18 4:07 ` [PATCH 3/7] dmaengine: mmp_pdma: drain channel tasklets " Jiale Yao
2026-10-18 4:07 ` [PATCH 4/7] dmaengine: mmp_tdma: synchronize tasklet when freeing a channel Jiale Yao
2026-10-18 4:07 ` Jiale Yao [this message]
2026-10-18 4:07 ` [PATCH 6/7] dmaengine: mxs-dma: " Jiale Yao
2026-10-18 4:07 ` [PATCH 7/7] dmaengine: ste_dma40: synchronize tasklet when releasing " Jiale Yao
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=20261018040724.534641-6-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=Frank.Li@kernel.org \
--cc=buytenh@marvell.com \
--cc=djbw@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.sosnowski@intel.com \
--cc=nico@marvell.com \
--cc=saeed@marvell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®