From: Shuai Liu <847807867@qq.com>
To: thdwjdgkr123@gmail.com, richard@nod.at, dwmw2@infradead.org
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
syzbot+250fde257a3eebba4426@syzkaller.appspotmail.com,
Shuai Liu <847807867@qq.com>
Subject: Re: [PATCH] jffs2: keep alloc_sem held when a write retry cannot reserve space
Date: Mon, 16 Nov 2026 14:40:24 +0800 [thread overview]
Message-ID: <tencent_1684827B82B415CBAF7C7AD30E6EBCD8D406@qq.com> (raw)
In-Reply-To: <20261102173342.314251-1-thdwjdgkr123@gmail.com>
Hi,
I independently verified this fix with the syzbot C reproducer on top
of Linux 7.4-rc3 (master), using mtdram with 128 KiB total size /
4 KiB erase size, CONFIG_JFFS2_SUMMARY=y and CONFIG_PROVE_LOCKING=y,
closely matching the syzbot configuration. The patch applies cleanly
to this tree.
Baseline (before the patch):
- The fail-nth scan in the reproducer triggers the lockdep warning
at N=10:
WARNING: bad unlock balance detected!
repro/67 is trying to release lock (&c->alloc_sem) at:
jffs2_do_create+0x229/0x250 fs/jffs2/write.c:474
but there are no more locks to release!
- The call chain matches the syzbot report: jffs2_sum_add_kvec()
fails with -ENOMEM, jffs2_write_dnode() drops alloc_sem for the
retry reservation which then fails with -ENOSPC, and
jffs2_do_create() calls jffs2_complete_reservation() on a lock it
no longer holds.
With the patch applied:
- 2 runs x 2000 fail-nth rounds, zero lockdep reports.
- The failure path is still reached: in one run the injected
allocation failure landed in jffs2_sum_add_kvec() ("Write of 68
bytes at 0x0001e00c failed. returned -12, retlen 0"), creat()
still returns -ENOSPC as expected, and the second unlock is now
balanced.
Tested-by: Shuai Liu <847807867@qq.com>
AI assistance disclosure: the two-state test environment (kernel
config, QEMU setup and log analysis) was prepared with the help of an
AI coding assistant, per Documentation/process/coding-assistants.rst.
The conclusions above are from actual test runs.
Best regards,
Shuai Liu
prev parent reply other threads:[~2026-11-16 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 17:33 Song jeonghak
2026-11-16 6:40 ` Shuai Liu [this message]
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=tencent_1684827B82B415CBAF7C7AD30E6EBCD8D406@qq.com \
--to=847807867@qq.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=syzbot+250fde257a3eebba4426@syzkaller.appspotmail.com \
--cc=thdwjdgkr123@gmail.com \
/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®