mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: spi-nor: Fix unbind deadlock and use-after-free
@ 2026-09-03  3:14 tze.yee.ng
  2026-09-03  3:14 ` [PATCH 1/2] mtd: spi-nor: Fix deadlock in spi_nor_rww_start_exclusive() tze.yee.ng
  2026-09-03  3:14 ` [PATCH 2/2] mtd: spi-nor: core: Fix use-after-free of spi_nor on unbind with open handles tze.yee.ng
  0 siblings, 2 replies; 3+ messages in thread
From: tze.yee.ng @ 2026-09-03  3:14 UTC (permalink / raw)
  To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Tudor Ambarus,
	linux-mtd, linux-kernel

From: Tze Yee Ng <tze.yee.ng@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-03  3:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03  3:14 [PATCH 0/2] mtd: spi-nor: Fix unbind deadlock and use-after-free tze.yee.ng
2026-09-03  3:14 ` [PATCH 1/2] mtd: spi-nor: Fix deadlock in spi_nor_rww_start_exclusive() tze.yee.ng
2026-09-03  3:14 ` [PATCH 2/2] mtd: spi-nor: core: Fix use-after-free of spi_nor on unbind with open handles tze.yee.ng

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®