summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@gmail.com>2024-10-18 04:33:10 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-08 16:30:55 +0100
commit56c6171932a7fb267ac6cb4ff8759b93ee1d0e2e (patch)
tree6a9070572e14f2d1deb13ca32865b122619b8891 /fs
parent37aba6e268466ccaeb963d6e589ce8d340fb41af (diff)
downloadlinux-56c6171932a7fb267ac6cb4ff8759b93ee1d0e2e.tar.gz
linux-56c6171932a7fb267ac6cb4ff8759b93ee1d0e2e.tar.bz2
linux-56c6171932a7fb267ac6cb4ff8759b93ee1d0e2e.zip
nilfs2: fix kernel bug due to missing clearing of checked flag
commit 41e192ad2779cae0102879612dfe46726e4396aa upstream. 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. Link: https://lkml.kernel.org/r/20241017193359.5051-1-konishi.ryusuke@gmail.com Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption") Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959 Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/page.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 7f9073d5c5a5..097e2c7f7f71 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -409,6 +409,7 @@ void nilfs_clear_folio_dirty(struct folio *folio, bool silent)
folio_clear_uptodate(folio);
folio_clear_mappedtodisk(folio);
+ folio_clear_checked(folio);
head = folio_buffers(folio);
if (head) {