From: "NG, TZE YEE" <tze.yee.ng@altera.com>
To: Michael Walle <mwalle@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>,
Takahiro Kuwano <takahiro.kuwano@infineon.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mtd: spi-nor: Fix deadlock in spi_nor_rww_start_exclusive()
Date: Tue, 6 Oct 2026 10:13:43 +0800 [thread overview]
Message-ID: <9baf125f-bd02-4523-a23b-516f567f3777@altera.com> (raw)
In-Reply-To: <DLKSSLURXYDB.2VSDOA0K7U9MN@kernel.org>
On 21/9/2026 2:58 pm, Michael Walle wrote:
> On Thu Sep 3, 2026 at 5:14 AM CEST, tze.yee.ng wrote:
>> From: Tze Yee Ng <tze.yee.ng@altera.com>
>>
>> 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@vger.kernel.org
>> Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
>
> This was already fixed in:
> https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=44b8a0bf5f96e8393312fc34b956766882341f16
>
> -michael
Thanks Michael, you're right. I missed that commit. I'll drop this patch
and resend the use-after-free fix (patch 2/2) standalone as v2.
Thanks,
Tze Yee
next prev parent reply other threads:[~2026-10-06 2:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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-21 6:58 ` Michael Walle
2026-10-06 2:13 ` NG, TZE YEE [this message]
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
2026-09-21 7:26 ` Michael Walle
2026-10-06 2:13 ` NG, TZE YEE
[not found] ` <SJ0PR03MB5950909EBD8335469678D0A2A1842@SJ0PR03MB5950.namprd03.prod.outlook.com>
2026-09-21 6:35 ` Fw: [PATCH 0/2] mtd: spi-nor: Fix unbind deadlock and use-after-free NG, TZE YEE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9baf125f-bd02-4523-a23b-516f567f3777@altera.com \
--to=tze.yee.ng@altera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mwalle@kernel.org \
--cc=pratyush@kernel.org \
--cc=takahiro.kuwano@infineon.com \
--cc=tudor.ambarus@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®