Re: [PATCH 1/2] mtd: spi-nor: Fix deadlock in spi_nor_rww_start_exclusive()

From: Michael Walle

Date: Mon Sep 21 2026 - 03:04:45 EST


On Thu Sep 3, 2026 at 5:14 AM CEST, tze.yee.ng wrote:
> From: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>
>
> spi_nor_rww_start_exclusive() takes nor->lock with a bare mutex_lock()
> and returns with it held, while its counterpart
> spi_nor_rww_end_exclusive() re-acquires nor->lock via guard(mutex). Any
> exclusive operation on a read-while-write (SNOR_F_RWW) part thus
> deadlocks against itself.
>
> The exclusive section is serialized by the rww ongoing_io/rd/pe flags,
> so take nor->lock with guard(mutex) like the sibling start helpers.
>
> Fixes: 03e7bb864d9a9 ("mtd: spi-nor: use scope-based mutex cleanup helpers")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Tze Yee Ng <tze.yee.ng@xxxxxxxxxx>

This was already fixed in:
https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=44b8a0bf5f96e8393312fc34b956766882341f16

-michael

Attachment: signature.asc
Description: PGP signature