From: "Michael Walle" <mwalle@kernel.org>
To: "Romli, Khairul Anuar" <khairul.anuar.romli@altera.com>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"open list:SPI NOR SUBSYSTEM" <linux-mtd@lists.infradead.org>,
"open list" <linux-kernel@vger.kernel.org>,
"Gerlach, Matthew" <matthew.gerlach@altera.com>
Subject: Re: [PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver removal with active read or write operations
Date: Thu, 21 Aug 2025 08:44:57 +0200 [thread overview]
Message-ID: <DC7WIIFZQ448.3RW1U45I41129@kernel.org> (raw)
In-Reply-To: < <MN2PR03MB4927D29E06586CCE7D0547FEC632A@MN2PR03MB4927.namprd03.prod.outlook.com>
[-- Attachment #1.1: Type: text/plain, Size: 2433 bytes --]
Hi,
On Thu Aug 21, 2025 at 2:32 AM CEST, Khairul Anuar Romli wrote:
> Sorry for taking very long time to reply. Could you advise me what
> kind of analysis do you want me to provide?
Please don't top-post, see [1]. An explanation what is going wrong
and why (and no, a backtrace is not an explanation). Why is
dev->driver->owner NULL? Shouldn't it be guarded by a lock or
something? And esp. why is owner NULL in put_device().
-michael
>
> > -----Original Message-----
> > From: Michael Walle <mwalle@kernel.org>
> > Sent: Wednesday, 30 July, 2025 3:50 PM
> > To: Romli, Khairul Anuar <khairul.anuar.romli@altera.com>; Tudor Ambarus
> > <tudor.ambarus@linaro.org>; Pratyush Yadav <pratyush@kernel.org>; Miquel
> > Raynal <miquel.raynal@bootlin.com>; Richard Weinberger <richard@nod.at>;
> > Vignesh Raghavendra <vigneshr@ti.com>; open list:SPI NOR SUBSYSTEM
> > <linux-mtd@lists.infradead.org>; open list <linux-kernel@vger.kernel.org>;
> > Gerlach, Matthew <matthew.gerlach@altera.com>
> > Subject: Re: [PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver
> > removal with active read or write operations
> >
> > Hi,
> >
> > > > On Wed Jul 30, 2025 at 3:39 AM CEST, Khairul Anuar Romli wrote:
> > > > > From: kromli <khairul.anuar.romli@altera.com>
> > > > >
> > > > > Ensure that the pointer passed to module_put() in
> > > > > spi_nor_put_device() is not NULL before use. This change adds a
> > > > > guard clause to return early, preventing the kernel crash below
> > > > > when the cadence-qspi driver is removed during a dd operation:
> > > >
> > > > As already asked in v2. This needs a (more detailed) description
> > > > what is going on and what is going wrong.
> > > >
> > > > -michael
> > >
> > > Hi,
> > >
> > > We just run the following test we observe the crash.
> > >
> > > time dd if=/dev/mtd1 of=out.img bs=1MB count=1000 & echo spi0.0 >
> > > /sys/bus/spi/drivers/spi-nor/unbind
> > > echo spi0.0 > /sys/bus/spi/drivers/spi-nor/bind
> > >
> > > From the observation, the dd is not entirely terminated when the unbind
> > took place.
> > > Maybe there is other changes require to ensure the dd operation gets
> > > terminated when driver unbind/remove.
> >
> > I'd expect an analysis what's going wrong in the kernel to judge the correctness
> > of the patch.
> >
> > Thanks,
> > -michael
[1] https://subspace.kernel.org/etiquette.html
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Walle" <mwalle@kernel.org>
To: "Romli, Khairul Anuar" <khairul.anuar.romli@altera.com>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"open list:SPI NOR SUBSYSTEM" <linux-mtd@lists.infradead.org>,
"open list" <linux-kernel@vger.kernel.org>,
"Gerlach, Matthew" <matthew.gerlach@altera.com>
Subject: Re: [PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver removal with active read or write operations
Date: Thu, 21 Aug 2025 08:44:57 +0200 [thread overview]
Message-ID: <DC7WIIFZQ448.3RW1U45I41129@kernel.org> (raw)
In-Reply-To: < <MN2PR03MB4927D29E06586CCE7D0547FEC632A@MN2PR03MB4927.namprd03.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]
Hi,
On Thu Aug 21, 2025 at 2:32 AM CEST, Khairul Anuar Romli wrote:
> Sorry for taking very long time to reply. Could you advise me what
> kind of analysis do you want me to provide?
Please don't top-post, see [1]. An explanation what is going wrong
and why (and no, a backtrace is not an explanation). Why is
dev->driver->owner NULL? Shouldn't it be guarded by a lock or
something? And esp. why is owner NULL in put_device().
-michael
>
> > -----Original Message-----
> > From: Michael Walle <mwalle@kernel.org>
> > Sent: Wednesday, 30 July, 2025 3:50 PM
> > To: Romli, Khairul Anuar <khairul.anuar.romli@altera.com>; Tudor Ambarus
> > <tudor.ambarus@linaro.org>; Pratyush Yadav <pratyush@kernel.org>; Miquel
> > Raynal <miquel.raynal@bootlin.com>; Richard Weinberger <richard@nod.at>;
> > Vignesh Raghavendra <vigneshr@ti.com>; open list:SPI NOR SUBSYSTEM
> > <linux-mtd@lists.infradead.org>; open list <linux-kernel@vger.kernel.org>;
> > Gerlach, Matthew <matthew.gerlach@altera.com>
> > Subject: Re: [PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver
> > removal with active read or write operations
> >
> > Hi,
> >
> > > > On Wed Jul 30, 2025 at 3:39 AM CEST, Khairul Anuar Romli wrote:
> > > > > From: kromli <khairul.anuar.romli@altera.com>
> > > > >
> > > > > Ensure that the pointer passed to module_put() in
> > > > > spi_nor_put_device() is not NULL before use. This change adds a
> > > > > guard clause to return early, preventing the kernel crash below
> > > > > when the cadence-qspi driver is removed during a dd operation:
> > > >
> > > > As already asked in v2. This needs a (more detailed) description
> > > > what is going on and what is going wrong.
> > > >
> > > > -michael
> > >
> > > Hi,
> > >
> > > We just run the following test we observe the crash.
> > >
> > > time dd if=/dev/mtd1 of=out.img bs=1MB count=1000 & echo spi0.0 >
> > > /sys/bus/spi/drivers/spi-nor/unbind
> > > echo spi0.0 > /sys/bus/spi/drivers/spi-nor/bind
> > >
> > > From the observation, the dd is not entirely terminated when the unbind
> > took place.
> > > Maybe there is other changes require to ensure the dd operation gets
> > > terminated when driver unbind/remove.
> >
> > I'd expect an analysis what's going wrong in the kernel to judge the correctness
> > of the patch.
> >
> > Thanks,
> > -michael
[1] https://subspace.kernel.org/etiquette.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2025-08-21 9:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1753839339.git.khairul.anuar.romli@altera.com>
2025-07-30 1:39 ` [PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver removal with active read or write operations Khairul Anuar Romli
2025-07-30 1:39 ` Khairul Anuar Romli
2025-07-30 7:30 ` Michael Walle
2025-07-30 7:30 ` Michael Walle
2025-07-30 7:46 ` Romli, Khairul Anuar
2025-07-30 7:46 ` Romli, Khairul Anuar
[not found] ` < <MN2PR03MB49271E2D022D305BC149BA4FC624A@MN2PR03MB4927.namprd03.prod.outlook.com>
2025-07-30 7:50 ` Michael Walle
2025-07-30 7:50 ` Michael Walle
2025-08-21 0:32 ` Romli, Khairul Anuar
2025-08-21 0:32 ` Romli, Khairul Anuar
[not found] ` < <MN2PR03MB4927D29E06586CCE7D0547FEC632A@MN2PR03MB4927.namprd03.prod.outlook.com>
2025-08-21 6:44 ` Michael Walle [this message]
2025-08-21 6:44 ` Michael Walle
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=DC7WIIFZQ448.3RW1U45I41129@kernel.org \
--to=mwalle@kernel.org \
--cc=khairul.anuar.romli@altera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=matthew.gerlach@altera.com \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=tudor.ambarus@linaro.org \
--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.