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=1796385071; b=XKvR1icL/RZGSLQv7h1/La77Hgh3DEDyNPYamZvuvwr35rbesNIAP71F3pD+Vff86G51 5aAPteMpITSwAVSyeEf/EPIoSm+4eN6ucNazV6iMNvx0nLR1C+QS6FJGZryaukHLwn4Xp raZDZ64xJ10B7A00+5X123V35Hk1E3Jh7rWI2mpxzWlZr45YEFmPJo4NKwZwi4We+Zr5O elX3Xf3GdWivMQcQhyA6Cn9eA3MNNIiHWU/P2GmorHPTlIwet3xzH2p6c0tmpwJXt81FL d+Sc23sD/YhEhZPCWrhVVvo890WQUnXYNvBPRFO11lPvyoxrIQJtzPh7UAG7R6Waszg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385071; 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=F+FpE/pbw5PL+MfN+XNx/TxRvF3vaQqoii/jMdqXioo=; b=R1WNTRWWBCd+l4arcULbELqpd84KhqVbwBSII/SKKvFh3RIYBcOqt3l0tDZ9zYHv5W99 v/aeyTJu2CwEuLkrWPnyVOZDChf8vmVINcQMO0V+gmoUzZhp1maHUa1+pTISR8I1V51pP vacZ8IbeQqdnLBL7MLSwzJ0+NT9/c68d2RZkOaaofFPOtl2xUqtUGVWC4kQyyZyoC/OaH wm5hHnZsGsb96oSvfcwnu/PcHp8eQFquPXHeZqfzAp6cYSZ0Cpq5OH4crTz8OnYOGzu/y Jw9R58XErA7UeiF8QnhiLHRNmpNRwh318sLs8R7gSG7Hx43DRf10UOhNjAtshZYkA7w== 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=XlfnmFDY; 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 789C0606A322; Fri, 4 Dec 2026 11:51:11 +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=XlfnmFDY Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B6E1F000C2; Fri, 4 Dec 2026 11:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385071; bh=F+FpE/pbw5PL+MfN+XNx/TxRvF3vaQqoii/jMdqXioo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XlfnmFDYcUGXqH0giFrjd7lZko7JpMPUt3//owXyDo3HkCCKpM52fnufPYd9kOWsB L0YmFbBgmjoDXJErhSMaqmhZCpg1eXwnkCcgZcVAWm2xMrjK4Ybq2eaEA2KOYVJW93 qZ1dzI+G0ly0T157fWAf8tq4hYGeLhMmzIckmHk4= 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.6 0406/1167] fs/ntfs3: do not mark frame pages uptodate on read error Date: Fri, 4 Dec 2026 18:57:13 +0900 Message-ID: <20261204100712.599049411@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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: Kept the existing struct page *pg; declaration that upstream removes, and adjusted the hunk context for the out1: label before vunmap(frame_mem), since this tree's ni_read_frame() still uses pg elsewhere. ] 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 3e3c9caaddf54..230a731552e44 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2755,11 +2755,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