mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Myeonghun Pak <mhun512@gmail.com>
To: mporter@kernel.crashing.org, alex.bou9@gmail.com
Cc: linux-kernel@vger.kernel.org, ae878000@gmail.com
Subject: [PATCH] rapidio: tsi721: Cancel the self-rearming doorbell work on removal
Date: Sun, 11 Oct 2026 15:33:56 -0400	[thread overview]
Message-ID: <20261011193336.005f74ced603-1-mhun512@gmail.com> (raw)

tsi721_db_dpc() schedules idb_work again when another doorbell arrives
while it is restoring the queue interrupt. flush_work() waits for the
instance that was queued at the start of the flush, but does not prevent
that instance from queuing a successor. Removal can therefore free the
doorbell buffer and device state with another instance still pending.

Use cancel_work_sync() after freeing the IRQs. At that point the external
producer has stopped, and synchronous cancellation also handles a worker
that rearms itself. The non-rearming port-write work can still be flushed.

This issue was found by static analysis.

Fixes: 3670e7e12e58 ("rapidio/tsi721: fix inbound doorbell interrupt handling")
Assisted-by: LLM
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Compile-tested with GCC, W=1 (arm). No runtime testing.

 drivers/rapidio/devices/tsi721.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 71b87bf..2bae63e 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -2978,7 +2978,7 @@ static void tsi721_remove(struct pci_dev *pdev)
 
 	tsi721_disable_ints(priv);
 	tsi721_free_irq(priv);
-	flush_work(&priv->idb_work);
+	cancel_work_sync(&priv->idb_work);
 	flush_work(&priv->pw_work);
 	rio_unregister_mport(&priv->mport);
 

                 reply	other threads:[~2026-10-11 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261011193336.005f74ced603-1-mhun512@gmail.com \
    --to=mhun512@gmail.com \
    --cc=ae878000@gmail.com \
    --cc=alex.bou9@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mporter@kernel.crashing.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®