From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Maxim Levitsky" <maximlevitsky@gmail.com>
Cc: linux-mtd@lists.infradead.org, "David Woodhouse" <dwmw2@infradead.org>
Subject: Re: [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown
Date: Sun, 08 Nov 2026 21:15:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-204068@kernel.org> (raw)
In-Reply-To: <20261108-submit-r852-shutdown-work-v1-v1-1-8e448ad7c54c@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] mtd: rawnand: r852: unprotected register access in
r852_update_card_detect() [1]
--
commit 9d313af3cdbf139593a845ec29f559aa0df5bf6b
Author: James Hilliard <james.hilliard1@gmail.com>
mtd: rawnand: r852: prevent card work from being requeued during shutdown
This commit replaces cancel_delayed_work_sync() with
disable_delayed_work_sync() in r852_shutdown() so card_detect_work cannot
be requeued before interrupts are disabled.
> diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
> index 92c47d351c278..bf1c1be7f2aa7 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);
[Severity: High]
This problem wasn't introduced by this patch, but can
r852_update_card_detect() [1] race with r852_irq() on
R852_CARD_IRQ_ENABLE and unmask disabled interrupts?
drivers/mtd/nand/raw/r852.c:r852_update_card_detect() {
int card_detect_reg = r852_read_reg(dev, R852_CARD_IRQ_ENABLE);
...
r852_write_reg(dev, R852_CARD_IRQ_ENABLE, card_detect_reg);
}
card_detect_work calls r852_update_card_detect(), which performs this
read-modify-write without holding dev->irqlock:
CPU0 (kworker) CPU1 (<hardirq>)
r852_card_detect_work()
r852_update_card_detect()
reg = r852_read_reg(...)
r852_irq()
spin_lock_irqsave(&dev->irqlock)
r852_disable_irqs()
r852_write_reg(...)
spin_unlock_irqrestore(&dev->irqlock)
r852_write_reg(..., reg) <-- overwrites masked IRQs
When the worker writes back its stale value, it re-enables interrupts
that r852_irq() just masked, which can trigger an IRQ storm.
[1] https://sashiko.dev/#/bug/linux-c0fe7604-3210-4aa5-9a00-b60066cbe1db
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261108-submit-r852-shutdown-work-v1-v1-1-8e448ad7c54c@gmail.com?part=1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2026-11-08 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 21:04 [PATCH] mtd: rawnand: r852: prevent card work from being requeued during shutdown James Hilliard
2026-11-08 21:04 ` James Hilliard
2026-11-08 21:15 ` sashiko-bot [this message]
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-204068@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dwmw2@infradead.org \
--cc=james.hilliard1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=maximlevitsky@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vigneshr@ti.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.