[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241017193359.5051-1-konishi.ryusuke@gmail.com>
Date: Fri, 18 Oct 2024 04:33:10 +0900
From: Ryusuke Konishi <konishi.ryusuke@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-nilfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
syzbot <syzbot+d6ca2daf692c7a82f959@...kaller.appspotmail.com>,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] nilfs2: fix kernel bug due to missing clearing of checked flag
Syzbot reported that in directory operations after nilfs2 detects
filesystem corruption and degrades to read-only,
__block_write_begin_int(), which is called to prepare block writes,
may fail the BUG_ON check for accesses exceeding the folio/page size,
triggering a kernel bug.
This was found to be because the "checked" flag of a page/folio was
not cleared when it was discarded by nilfs2's own routine, which
causes the sanity check of directory entries to be skipped when the
directory page/folio is reloaded. So, fix that.
This was necessary when the use of nilfs2's own page discard routine
was applied to more than just metadata files.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@...il.com>
Reported-by: syzbot+d6ca2daf692c7a82f959@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959
Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
Cc: stable@...r.kernel.org
---
Hi Andrew, please apply this as a bug fix.
This fixes another kernel bug recently reported by syzbot.
Thanks,
Ryusuke Konishi
fs/nilfs2/page.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 5436eb0424bd..10def4b55995 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -401,6 +401,7 @@ void nilfs_clear_folio_dirty(struct folio *folio)
folio_clear_uptodate(folio);
folio_clear_mappedtodisk(folio);
+ folio_clear_checked(folio);
head = folio_buffers(folio);
if (head) {
--
2.43.0
Powered by blists - more mailing lists