Skip to content

Commit 41e192a

Browse files
konisakpm00
authored andcommitted
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. Link: https://lkml.kernel.org/r/[email protected] Fixes: 8c26c4e ("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 <[email protected]> Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959 Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent d95fb34 commit 41e192a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/nilfs2/page.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ void nilfs_clear_folio_dirty(struct folio *folio)
401401

402402
folio_clear_uptodate(folio);
403403
folio_clear_mappedtodisk(folio);
404+
folio_clear_checked(folio);
404405

405406
head = folio_buffers(folio);
406407
if (head) {

0 commit comments

Comments
 (0)