[PATCH v4 0/2] mtd: spi-nor: core: Fix RWW wait locking

Runyu Xiao runyu.xiao at seu.edu.cn
Wed Aug 19 07:03:35 PDT 2026


The RWW wait helpers must not block while evaluating the wait
condition. In the current code, spi_nor_rww_start_exclusive() can leave
nor->lock held on a false return. Also, if a killable RWW wait is
interrupted after spi_nor_prep(), the controller setup must be undone.

Patch 1 switches the four RWW start helpers to conditional scoped mutex
guards so the wait condition never sleeps and the mutex is always
released before returning.
Patch 2 unprepares the controller on interrupted waits in the three
spi_nor_prep_and_lock() helpers.

Runyu Xiao (2):
  mtd: spi-nor: core: Fix mutex leak in spi_nor_rww_start_exclusive()
  mtd: spi-nor: core: Unprepare after interrupted RWW wait

 drivers/mtd/spi-nor/core.c | 93 ++++++++++++++++++++++----------------
 1 file changed, 54 insertions(+), 39 deletions(-)

base-commit: 2b533e775aec580cf60074417f4ca00ac9cf3580
-- 
2.34.1



More information about the linux-mtd mailing list