From: Ryusuke Konishi konishi.ryusuke@gmail.com
mainline inclusion from mainline-v6.12-rc6 commit 41e192ad2779cae0102879612dfe46726e4396aa category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB37AW CVE: CVE-2024-50230
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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
Conflicts: fs/nilfs2/page.c [Context conflicts] Signed-off-by: Qi Xi xiqi2@huawei.com --- fs/nilfs2/page.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 81992b9a219b..2a39b7485b99 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -403,6 +403,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
ClearPageUptodate(page); ClearPageMappedToDisk(page); + ClearPageChecked(page);
if (page_has_buffers(page)) { struct buffer_head *bh, *head;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/13813 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Q...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/13813 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/Q...