Re: [PATCH v4 1/2] mtd: spi-nor: core: Fix mutex leak in spi_nor_rww_start_exclusive()

From: Miquel Raynal

Date: Tue Aug 25 2026 - 08:29:45 EST


On 19/08/2026 at 22:03:36 +08, Runyu Xiao <runyu.xiao@xxxxxxxxxx> wrote:

> The RWW wait helpers must not block while evaluating the condition.
> spi_nor_rww_start_exclusive() used mutex_lock() directly and could return
> with nor->lock still held.
>
> Switch the four RWW start helpers to conditional scoped mutex guards so
> the wait condition never sleeps and nor->lock is released before
> return.

What? Why?

Please.

Previous patch was right, why are you converting to scope guard?

You did not pick the Reviewed-by tags.
>
> Fixes: 74df43b3f626 ("mtd: spi-nor: Enhance locking to support reads
> while writes")

This Fixes is wrong, the original one was right, please check the entire
conversation.

> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
>
> Changes in v4:

Changelog should not be here but below the ---.

You miss changes from v2 and v3.

> - Use the original RWW locking commit in Fixes and update the subject.
> - Apply the locking fix to all RWW start helpers used as wait conditions.
> - Keep commit 03e7bb864d9a ("mtd: spi-nor: use scope-based mutex
> cleanup helpers") as a stable prerequisite because it adds
> cleanup.h.

Where did you do that?

If you want to fix the remaining Sashiko issue (the sleep issue) you
can, but please do it in another patch.

Thanks,
Miquèl