From: eltavine <me@eltavine.com>
To: Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Leonid Arapov <arapovl839@gmail.com>,
Zhihao Cheng <chengzhihao1@huawei.com>,
syzbot+0727f46a0571de01bf93@syzkaller.appspotmail.com,
syzbot+48f2d47f83a4c223ad14@syzkaller.appspotmail.com,
syzbot+e4484dcf0982d86ca2e1@syzkaller.appspotmail.com
Subject: [RFC PATCH] jffs2: disable empty summaries instead of calling BUG()
Date: Thu, 15 Oct 2026 22:53:41 +0800 [thread overview]
Message-ID: <20261015145341.34322-1-me@eltavine.com> (raw)
With CONFIG_JFFS2_SUMMARY enabled, jffs2_do_reserve_space() tries to
write out the current block's summary when a node and its summary
overhead do not fit. jffs2_sum_write_sumnode() assumes that at least
one summary entry has been collected and calls BUG() otherwise.
An empty summary is a valid state. For example, the syzbot reproducer
mounts an image whose selected nextblock contains only a cleanmarker
and padding, leaving 140 bytes free and no summary entries. Creating
a symlink needs 128 bytes for its inode node, but reserving another
60 bytes for the summary reaches the BUG():
kernel BUG at fs/jffs2/summary.c:868!
Large pristine-node GC reservations and xattr updates that fail after
reserving space can also leave a newly selected block with an empty
summary and reach the same check.
Disable summary collection for the block and return through the
existing exit path. jffs2_do_reserve_space() then retries the
reservation without summary overhead, following the existing fallback
for a summary that does not fit. Use dbg_summary() for this valid
condition.
The block is scanned normally on the next mount. The on-flash format
and xattr size limits are unchanged.
Fixes: e631ddba5887 ("[JFFS2] Add erase block summary support (mount time improvement)")
Reported-by: syzbot+0727f46a0571de01bf93@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0727f46a0571de01bf93
Reported-by: syzbot+48f2d47f83a4c223ad14@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=48f2d47f83a4c223ad14
Reported-by: syzbot+e4484dcf0982d86ca2e1@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e4484dcf0982d86ca2e1
Cc: stable@vger.kernel.org
Signed-off-by: eltavine <me@eltavine.com>
---
Validation: Built fs/jffs2/ in an arm64 Linux VM with GCC 13.3 (W=1),
with and without summary support; the latter warns about unused vecs
in writev.c. Not runtime-tested.
I'm working from an arm64 Mac and don't have a physical Linux test
machine available. Sorry for the limited testing; I'd appreciate
review and help running the reproducer:)
fs/jffs2/summary.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index 4521a7723f30..4a07b7911b21 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -864,8 +864,11 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
goto out;
if (!c->summary->sum_num || !c->summary->sum_list_head) {
- JFFS2_WARNING("Empty summary info!!!\n");
- BUG();
+ /* Nothing collected yet, e.g. freshly opened jeb */
+ dbg_summary("empty summary, disabling it for jeb at 0x%08x\n",
+ jeb->offset);
+ jffs2_sum_disable_collecting(c->summary);
+ goto out;
}
datasize = c->summary->sum_size + sizeof(struct jffs2_sum_marker);
base-commit: 0fcb05b72344f40806cbe810de8872f1698bf053
reply other threads:[~2026-10-15 15:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261015145341.34322-1-me@eltavine.com \
--to=me@eltavine.com \
--cc=arapovl839@gmail.com \
--cc=chengzhihao1@huawei.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=syzbot+0727f46a0571de01bf93@syzkaller.appspotmail.com \
--cc=syzbot+48f2d47f83a4c223ad14@syzkaller.appspotmail.com \
--cc=syzbot+e4484dcf0982d86ca2e1@syzkaller.appspotmail.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®