From: sashiko-bot@kernel.org
To: "Ziyu Zhang" <ziyuzhang201@gmail.com>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Fix deadlock on interrupt handle revocation
Date: Wed, 25 Nov 2026 11:48:51 +0000 [thread overview]
Message-ID: <sashiko-outbox-233285@kernel.org> (raw)
In-Reply-To: <20261125113553.94215-1-ziyuzhang201@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] dmaengine: idxd: active work reinit and missing cancel on
interrupt setup
--
commit e10f41baa968851823cafa610d6872d2435dbbf7
Author: Ziyu Zhang <ziyuzhang201@gmail.com>
dmaengine: idxd: Fix deadlock on interrupt handle revocation
This commit embeds int_handle_revoke_work in struct idxd_device and queues
it unconditionally on IDXD_INTC_INT_HANDLE_REVOKED, removing the dynamic
work allocation and synchronous idxd_wqs_quiesce() fallback.
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index 4b827a3297564..f3ade8036ddb7 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -108,6 +108,7 @@ static int idxd_setup_interrupts(struct idxd_device *idxd)
> }
> dev_dbg(dev, "Enabled %d msix vectors\n", msixcnt);
>
> + INIT_WORK(&idxd->int_handle_revoke_work, idxd_int_handle_revoke);
>
> ie = idxd_get_ie(idxd, 0);
> ie->vector = pci_irq_vector(pdev, 0);
[Severity: High]
Can idxd_setup_interrupts() reinitialize idxd->int_handle_revoke_work
while it is pending or running, and does idxd_cleanup_interrupts() leave
it uncancelled?
idxd_setup_interrupts() also runs during FLR recovery via
idxd_reset_done() -> idxd_pci_probe_alloc(idxd, NULL, NULL), which calls
idxd_cleanup_interrupts() and idxd_setup_interrupts() back-to-back on an
existing device without cancelling int_handle_revoke_work:
drivers/dma/idxd/init.c:idxd_pci_probe_alloc() {
...
if (!alloc_idxd) {
/* Release interrupts in the IDXD device. */
idxd_cleanup_interrupts(idxd);
/* Re-enable interrupts in the IDXD device. */
rc = idxd_setup_interrupts(idxd);
...
}
kworker (idxd->wq) <irq thread> (idxd_misc_thread)
idxd_device_flr()
cause & IDXD_INTC_INT_HANDLE_REVOKED
queue_work(idxd->wq,
&idxd->int_handle_revoke_work)
pci_reset_function()
...
idxd_reset_done()
idxd_pci_probe_alloc()
idxd_cleanup_interrupts()
free_irq(ie->vector, ie)
idxd_setup_interrupts()
INIT_WORK(&idxd->int_handle_revoke_work, ...)
<-- reinitializes queued work, corrupting pwq->worklist
Calling INIT_WORK() on a queued work item corrupts pwq->worklist and
clears WORK_STRUCT_PWQ in work->data, leading to a NULL pointer
dereference in process_one_work(). Because idxd_cleanup_interrupts() does
not cancel the work after free_irq(), a pending or running
idxd_int_handle_revoke() can also hang waiting on idxd->cmd_done after the
misc IRQ is freed, or access idxd->wqs and idxd->reg_base after they are
torn down in idxd_cleanup_internals() or idxd_remove().
Initializing idxd->int_handle_revoke_work once during device allocation
(such as in idxd_setup_internals()) and calling
cancel_work_sync(&idxd->int_handle_revoke_work) after free_irq() in
idxd_cleanup_interrupts() would avoid both problems.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125113553.94215-1-ziyuzhang201@gmail.com?part=1
next prev parent reply other threads:[~2026-11-25 11:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:35 [PATCH] dmaengine: idxd: Fix deadlock on interrupt handle revocation Ziyu Zhang
2026-11-25 11:48 ` sashiko-bot [this message]
2026-11-30 16:12 ` Dave Jiang
2026-12-01 2:55 ` ziyu zhang
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=sashiko-outbox-233285@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=ziyuzhang201@gmail.com \
/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.