mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RDMA/erdma: fix use-after-free in CEQ tasklet teardown
@ 2026-07-21 13:37 Fan Wu
  2026-07-22  2:02 ` Cheng Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Fan Wu @ 2026-07-21 13:37 UTC (permalink / raw)
  To: chengyou; +Cc: kaishen, jgg, leon, linux-rdma, linux-kernel, stable, Fan Wu

The CEQ interrupt handler schedules a tasklet that accesses the CEQ
buffers. During teardown, erdma_free_ceq_irq() removes the interrupt
handler and waits for any in-flight handler invocation, but does not
wait for a tasklet that was already scheduled by that handler.

erdma_ceq_uninit_one() can then free the EQ qbuf and dbrec while the
tasklet is still accessing them.

Call tasklet_kill() after free_irq(). This prevents new tasklet
scheduling and waits for any already scheduled tasklet before the EQ
buffers are freed.

This issue was found by an in-house static analysis tool.

Fixes: f2a0a630b953 ("RDMA/erdma: Add event queue implementation")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
---
 drivers/infiniband/hw/erdma/erdma_eq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/erdma/erdma_eq.c b/drivers/infiniband/hw/erdma/erdma_eq.c
index 6486234a2360..78ebec6d48a3 100644
--- a/drivers/infiniband/hw/erdma/erdma_eq.c
+++ b/drivers/infiniband/hw/erdma/erdma_eq.c
@@ -219,6 +219,7 @@ static void erdma_free_ceq_irq(struct erdma_dev *dev, u16 ceqn)

 	irq_set_affinity_hint(eqc->irq.msix_vector, NULL);
 	free_irq(eqc->irq.msix_vector, eqc);
+	tasklet_kill(&dev->ceqs[ceqn].tasklet);
 }

 static int create_eq_cmd(struct erdma_dev *dev, u32 eqn, struct erdma_eq *eq)
--
2.34.1


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

end of thread, other threads:[~2026-07-22  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-21 13:37 [PATCH] RDMA/erdma: fix use-after-free in CEQ tasklet teardown Fan Wu
2026-07-22  2:02 ` Cheng Xu

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®