[PATCH v3 0/2] mtd: spi-nor: fix use-after-free on unbind with open handles

NG, TZE YEE tze.yee.ng at altera.com
Wed Nov 25 00:09:18 PST 2026



On 20/11/2026 4:12 pm, Michael Walle wrote:
> Hi,
> 
> On Fri Nov 20, 2026 at 3:21 AM CET, TZE YEE NG wrote:
>> I would prefer to keep this series as a spi-nor-only fix, since it
>> solves the problem for spi-nor today. James Hilliard's raw NAND series
>> [1] adds a generic opt-in lifetime to the core (mtd_set_release()). I
>> would be happy to look at moving spi-nor onto it if it lands, but maybe
>> in another series. Are you okay with keeping this series as is?
> 
> No, not really. Sorry. Esp. given how cluttered it is and just
> solves the problem for one user of the MTD subsystem.
> 
> -michael

Hi Michael,

Understood, thanks for the direct answer. I'll drop the idea of merging
this as a spi-nor-only fix.

Two questions so I can pick the right next step:

1. Patch 1 (the module_put() reorder in __put_mtd_device()) is a small,
    independent fix, and James's series [1] lists it as a prerequisite.
    Are you okay with me sending it separately?

2. For spi-nor, would you prefer I wait for the core lifetime in
    James's series (mtd_set_release()) and convert spi-nor onto it? I
    can do the spi-nor conversion and test it on hardware. I can't test
    the other MTD drivers.

Thanks,
Tze Yee

[1] 
https://lore.kernel.org/all/20261115-submit-rawnand-retained-handle-lifetime-v1-v5-0-cbc49c5c5e74@gmail.com/



More information about the linux-mtd mailing list