mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown
@ 2026-11-08 21:04 James Hilliard
  2026-11-20 15:04 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-11-08 21:04 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxim Levitsky
  Cc: linux-mtd, linux-kernel, David Woodhouse, stable, James Hilliard

The card interrupt can queue card_detect_work after shutdown cancels it
but before interrupts are disabled. The worker can then access the
controller after pci_disable_device(), and can enable card interrupts
again while processing the event.

Disable and drain the delayed work before turning off interrupts and the
PCI device. Later queue attempts are rejected while the IRQ handler can
still acknowledge events until interrupt teardown completes.

Fixes: 67e054e91924 ("mtd: nand: Add driver for Ricoh xD/SmartMedia reader")
Cc: stable@vger.kernel.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/mtd/nand/raw/r852.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
index 92c47d351c27..bf1c1be7f2aa 100644
--- a/drivers/mtd/nand/raw/r852.c
+++ b/drivers/mtd/nand/raw/r852.c
@@ -1007,7 +1007,7 @@ static void r852_shutdown(struct pci_dev *pci_dev)
 {
 	struct r852_device *dev = pci_get_drvdata(pci_dev);
 
-	cancel_delayed_work_sync(&dev->card_detect_work);
+	disable_delayed_work_sync(&dev->card_detect_work);
 	r852_disable_irqs(dev);
 	synchronize_irq(dev->irq);
 	pci_disable_device(pci_dev);

---
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
change-id: 20261107-submit-r852-shutdown-work-v1-15fe04537064

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


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

* Re: [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown
  2026-11-08 21:04 [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown James Hilliard
@ 2026-11-20 15:04 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-11-20 15:04 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Maxim Levitsky, James Hilliard
  Cc: linux-mtd, linux-kernel, David Woodhouse, stable

On Sun, 08 Nov 2026 14:04:21 -0700, James Hilliard wrote:
> The card interrupt can queue card_detect_work after shutdown cancels it
> but before interrupts are disabled. The worker can then access the
> controller after pci_disable_device(), and can enable card interrupts
> again while processing the event.
> 
> Disable and drain the delayed work before turning off interrupts and the
> PCI device. Later queue attempts are rejected while the IRQ handler can
> still acknowledge events until interrupt teardown completes.
> 
> [...]

Applied to nand/next, thanks!

[1/1] mtd: rawnand: r852: prevent card work from being requeued during shutdown
      commit: ec1e844b9486302a488abc03ea918db60709766e

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl


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

end of thread, other threads:[~2026-11-20 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 21:04 [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown James Hilliard
2026-11-20 15:04 ` Miquel Raynal

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®