Skip to content
Snippets Groups Projects
Commit aa0cee46 authored by Ryusuke Konishi's avatar Ryusuke Konishi Committed by Greg Kroah-Hartman
Browse files

nilfs2: fix kernel bug due to missing clearing of checked flag

commit 41e192ad 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: 8c26c4e2 ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: default avatar <syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959


Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bfd1d223
No related branches found
No related tags found
2 merge requests!185🤖 Sync Bot: Update v5.10-ktn to Latest Stable Kernel (v5.10.234),!172🤖 Sync Bot: Update v5.10-ktn to Latest Stable Kernel (v5.10.230)
...@@ -404,6 +404,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent) ...@@ -404,6 +404,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
ClearPageUptodate(page); ClearPageUptodate(page);
ClearPageMappedToDisk(page); ClearPageMappedToDisk(page);
ClearPageChecked(page);
if (page_has_buffers(page)) { if (page_has_buffers(page)) {
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment