From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AEC01E2842; Wed, 6 Nov 2024 12:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730896889; cv=none; b=QYpwDc4d2ehmzb9yM1wHBgkhTpcZdV5qCTK2pyyd9HaWlq1QWmW484OLszR3lWSX9aFGSLI8hM3DQ/N6lPloaDvpch9RJeK04WtE47Ec7iut3EwPOz3/A4c7TmkdmPaw13jJFe2ygUo3xzCg3v0NXuANcIHzn/6N4Gezx/4gPNc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730896889; c=relaxed/simple; bh=8bwbTCZFJtw5HtqR2Q4LhSNEu7F8au9WXUpftK6a4M8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mm0cVMF5jPa6W1dqg2/96zOnZO/KB9XfUkJe037KQDRHe2Q/IwXHYLZ1dL4Mx/hnyF4E/USFq9g/6QH7nGImONHVOmRk70PQDKpZTHkzzWqHJF/5F/0/L1QFxkYd6eIHwUWb2EngfCBJ6o3UPsfEJdb5xtloa4+3Y2/6OlMBCT0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R98WiKw4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R98WiKw4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08763C4CECD; Wed, 6 Nov 2024 12:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730896889; bh=8bwbTCZFJtw5HtqR2Q4LhSNEu7F8au9WXUpftK6a4M8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R98WiKw4kRNM4m3EZTC+5NB5CWEDLFjZZLJl0Q6sNUJsRf4CU9CVZyAHe4Utl6Rz6 Fyahy3e1AEIhMvP++ScyTctcsZP3+HBEjgHUs57nQcB6tu1ftzTTrVgBcGEeLcZkVi RjVfNqfZJSgZ1F9CeZ2Hiv2he7pJXspn0oRN1+to= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ryusuke Konishi , syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 5.10 105/110] nilfs2: fix kernel bug due to missing clearing of checked flag Date: Wed, 6 Nov 2024 13:05:11 +0100 Message-ID: <20241106120306.073010478@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120303.135636370@linuxfoundation.org> References: <20241106120303.135636370@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ryusuke Konishi 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 Reported-by: syzbot+d6ca2daf692c7a82f959@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=d6ca2daf692c7a82f959 Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/page.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -404,6 +404,7 @@ void nilfs_clear_dirty_page(struct page ClearPageUptodate(page); ClearPageMappedToDisk(page); + ClearPageChecked(page); if (page_has_buffers(page)) { struct buffer_head *bh, *head;