mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Itai Handler" <itai.handler@gmail.com>, <pratyush@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
	<vigneshr@ti.com>, <richard@nod.at>, <miquel.raynal@bootlin.com>,
	<takahiro.kuwano@infineon.com>
Subject: Re: [PATCH 2/2] mtd: spi-nor: take the flash lock in spi_nor_remove()
Date: Mon, 14 Sep 2026 10:32:59 +0200	[thread overview]
Message-ID: <DLEWF5DGXYAE.179JK12YIHHID@kernel.org> (raw)
In-Reply-To: <20260910184452.895485-3-itai.handler@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

On Thu Sep 10, 2026 at 8:44 PM CEST, Itai Handler wrote:
> spi_nor_remove() restores the addressing mode with the same unlocked
> call to spi_nor_restore() that spi_nor_shutdown() used before the
> previous patch, and it is exposed the same way: the MTD device is still
> registered at that point, so an unbind can run the restore while another
> thread is in the middle of an operation. A busy flash silently ignores
> the restore, and a restore that lands between two chunks of a read
> switches the chip to 3-byte addressing while the driver keeps sending
> 4 address bytes.
>
> Moving the restore after mtd_device_unregister() would not fix this.
> Since commit 19bfa9ebebb5 ("mtd: use refcount to prevent corruption")
> del_mtd_device() drops a reference instead of refusing with -EBUSY when
> the device is in use, so unregistering returns right away and does not
> wait for an operation that is already running.
>
> Take nor->lock for the restore, as spi_nor_shutdown() now does. The
> unregister stays unconditional, so a flash whose restore had to be
> skipped is still torn down.

Why are these two different patches? This should be folded into the
former one.

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

      parent reply	other threads:[~2026-09-14  8:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 18:44 [PATCH 0/2] mtd: spi-nor: fix the unlocked restore on shutdown and remove Itai Handler
2026-09-10 18:44 ` [PATCH 1/2] mtd: spi-nor: take the flash lock in spi_nor_shutdown() Itai Handler
2026-09-10 19:01   ` sashiko-bot
2026-09-14  8:08     ` Itai Handler
2026-09-14  8:31       ` Michael Walle
2026-09-10 18:44 ` [PATCH 2/2] mtd: spi-nor: take the flash lock in spi_nor_remove() Itai Handler
2026-09-10 19:02   ` sashiko-bot
2026-09-14  8:11     ` Itai Handler
2026-09-14  8:32   ` Michael Walle [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=DLEWF5DGXYAE.179JK12YIHHID@kernel.org \
    --to=mwalle@kernel.org \
    --cc=itai.handler@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=takahiro.kuwano@infineon.com \
    --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 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®