[PATCH v3 1/1] mtd: spi-nor: core: Prevent oops during driver removal with active read or write operations
Michael Walle
mwalle at kernel.org
Wed Aug 20 23:44:57 PDT 2025
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 at kernel.org>
> > Sent: Wednesday, 30 July, 2025 3:50 PM
> > To: Romli, Khairul Anuar <khairul.anuar.romli at altera.com>; Tudor Ambarus
> > <tudor.ambarus at linaro.org>; Pratyush Yadav <pratyush at kernel.org>; Miquel
> > Raynal <miquel.raynal at bootlin.com>; Richard Weinberger <richard at nod.at>;
> > Vignesh Raghavendra <vigneshr at ti.com>; open list:SPI NOR SUBSYSTEM
> > <linux-mtd at lists.infradead.org>; open list <linux-kernel at vger.kernel.org>;
> > Gerlach, Matthew <matthew.gerlach at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20250821/6c1e92b5/attachment.sig>
More information about the linux-mtd
mailing list