From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387854; b=afOXFM9hvO1YB08eoGNeRZz6yB112e/KNwsO8gZ/qooFlSevX4VzGVml884OxTqrdRV+ Z7NmAV8l2jnFbA5TmcjsNez2u4SJyeNQNo7tLYdifhjl2Sgbsc+p7uHbHq6Z/eMSZYYaI ugaFKw1qUZsiayZjrX03LvhZ1gcCxCZ3jDvFAmMjPoQAPQ6tZQtUR4sFjqknNFZQgmyzH fWrLZUGSIe+f54YRYS72Nmg3DkDwMZe66Oxp5kcAJvHYJs073Yyaf1rI04tJA0P0WvRAC y/hsyIdqDfviQe6AodXrFMTgU+Dn5DDymwIwvlfGYMMdzRdob1SX+gOjj0uJSaclXzg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387854; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=WM1XsaZCVpRnszbruGCR2cawDIP2ckTg8crO+ReG8GQ=; b=YwHWfRPMarG4kUDvz6xyV5wusMD7pRcyfGIFFZgwH2HkfQmK67csY8Tzq6hXiZxPnuI6 EFN5NmnG0PyGxs7YBDolhBLdXWIbv/YVijVDxfANrvRLlMahAIBEgXeftWtaSgH3quY0s gVCVA2qR5GlNek5LxwqnBJrS3KU5M7w4/1Nqt/jDmrAJYpYK6qz0vis/G30afAVOdt8Rp iwCWLN/HRODOTs4O17B4Fw4Th78VuoBPI1rxIAsrZq8HFcj1dG8SamDz17LgLP/I3d2x9 +YV99rlF/pOI6Px1WgWThBlNeuM/cfLQYqnz3AxprW4Ko6xEK/5OPMpzNi+CP/T7gZw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=bQ8h6tUi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EDA6606A32C; Fri, 4 Dec 2026 12:37:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=bQ8h6tUi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE361F000C2; Fri, 4 Dec 2026 12:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387854; bh=WM1XsaZCVpRnszbruGCR2cawDIP2ckTg8crO+ReG8GQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bQ8h6tUiBu+fu7szo3Rddf6EBDC0KTpGTetNrLqIUTER0k8ouJZbzKvXDcm0NWuXM Kq0OI8QV9qX1TXtq2LUszlmJq+ZXUO+Uci7x9M5461+SBL0eLKHn99zquQcsHauUH5 36ubUAlzlIhK7SLT3Ux99al8qWwiDjW4kpHo5NRc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xiang Mei , Weiming Shi , Konstantin Komarov , Sasha Levin Subject: [PATCH 6.1 0385/1059] fs/ntfs3: do not mark frame pages uptodate on read error Date: Fri, 4 Dec 2026 18:58:36 +0900 Message-ID: <20261204100654.274923255@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Weiming Shi [ Upstream commit 80218408836fa6fc91a9c26a9c014f81abf9e41f ] ni_read_frame() ends with a loop that marks every page of a compressed frame uptodate regardless of whether the read succeeded: out: for (i = 0; i < pages_per_frame; i++) { pg = pages[i]; SetPageUptodate(pg); } Non-critical frame pages come from __filemap_get_folio(FGP_CREAT) and are not zeroed. On an error path that reaches out: before frame_mem is written, these pages keep uninitialized page-allocator contents but are still marked uptodate. A later read() is then served from the page cache and returns that stale kernel memory to user space. For an unprivileged user mounting a crafted NTFS image this is a repeatable kernel memory disclosure. Mark the pages uptodate only on success; on error leave them !uptodate so the read path re-reads them or reports the error. Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") Reported-by: Xiang Mei Signed-off-by: Weiming Shi Signed-off-by: Konstantin Komarov [ sashal: Only the ni_read_frame() out: loop was changed; the unused-variable removal for pg was not carried over because this tree still uses pg elsewhere in the function. ] Signed-off-by: Sasha Levin --- fs/ntfs3/frecord.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index b8b5304be183e..4eab9dda3738e 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2830,11 +2830,10 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages, out1: vunmap(frame_mem); out: - for (i = 0; i < pages_per_frame; i++) { - pg = pages[i]; - if (err) - clear_highpage(pg); - SetPageUptodate(pg); + if (!err) { + for (i = 0; i < pages_per_frame; i++) { + SetPageUptodate(pages[i]); + } } return err; -- 2.53.0