Fw: [PATCH 0/2] mtd: spi-nor: Fix unbind deadlock and use-after-free

NG, TZE YEE tze.yee.ng at altera.com
Sun Sep 20 23:35:24 PDT 2026


On 21/9/2026 2:27 pm, NG, TZE YEE wrote:
> 
> *From:* NG, TZE YEE
> *Sent:* Thursday, September 3, 2026 11:14 AM
> *To:* Pratyush Yadav <pratyush at kernel.org>; Michael Walle 
> <mwalle at kernel.org>; Takahiro Kuwano <takahiro.kuwano at infineon.com>; 
> Tudor Ambarus <tudor.ambarus at linaro.org>; linux-mtd at lists.infradead.org 
> <linux-mtd at lists.infradead.org>; linux-kernel at vger.kernel.org <linux- 
> kernel at vger.kernel.org>
> *Subject:* [PATCH 0/2] mtd: spi-nor: Fix unbind deadlock and use-after-free
> From: Tze Yee Ng <tze.yee.ng at altera.com>
> 
> Two fixes in the spi-nor core around locking and driver unbind:
> 
> Patch 1 fixes a self-deadlock in spi_nor_rww_start_exclusive(), which
> took nor->lock while its end helper re-acquired it via guard(mutex).
> 
> Patch 2 fixes a use-after-free where a sysfs unbind frees the
> devm-allocated spi_nor while /dev/mtdX is still open. Give it a kref
> lifetime on the spi-mem probe path and fail operations with -ENODEV
> after unbind. Legacy controllers are unchanged.
> 
> Tze Yee Ng (2):
>    mtd: spi-nor: Fix deadlock in spi_nor_rww_start_exclusive()
>    mtd: spi-nor: core: Fix use-after-free of spi_nor on unbind with open
>      handles
> 
>   drivers/mtd/spi-nor/core.c  | 113 ++++++++++++++++++++++++++++++++----
>   include/linux/mtd/spi-nor.h |  17 ++++++
>   2 files changed, 119 insertions(+), 11 deletions(-)
> 
> -- 
> 2.43.7
> 

Hi,

Gentle ping on this patch. It has been over 2 weeks with no feedback.

Happy to address any review comments.

Thanks,
Tze Yee




More information about the linux-mtd mailing list