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 D7E9E35FF60; Tue, 16 Dec 2025 12:07:53 +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=1765886873; cv=none; b=TibsFSnRktYj3n0WrPbFwn1uKiP4s5Om18VEXNaqTbglUU4yFvVepYlx7d0B3N3r9ic1Dk3eD95r44J53e71Cf1T+1Z2BS7CE+Ob2tvUm86UoW8ax2m84YqPK0YCSOH1qCBvqmoL0/u1bC4tzgBjuufjV57KDnP3cRGzTqMLyHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765886873; c=relaxed/simple; bh=QIpTXqbYbgI+p8u//0Ih/k5m9ve9q7vGwQi//fWldBo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WrDef8O/WyRh2E/+1fOSNzIfBgil4D0q7oNdJrG+MomuwbV7MegT8fHMYkD0hMyplUVyZjtWDmHEiOhztN3+0HeOfNfmWsOM1w4Gd2jTl9PPRkLLlipLqtIU/NQGaFfIDeX44AZmWfu6+WuW5uTg3NsT8Kq/KunU8wg0ZQ4Xufc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2be4O4hn; 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="2be4O4hn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 465DAC4CEF1; Tue, 16 Dec 2025 12:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765886873; bh=QIpTXqbYbgI+p8u//0Ih/k5m9ve9q7vGwQi//fWldBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2be4O4hn0fsmx94oVEaPkLRav6hsF6pEAhRpcFnMcXxVbaZqQry1A2/wl6VttfHWE u6pJh2bcPctJqRfsOyGKTxzTQQD1pIWv6cQZ3TjCBy3Ss6kc1JfK/hwQx3EK7/ckXv TYNr+4Zxk/jmkj7111prjWiJyjBLYCH1RR6ZWAiA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com, Raphael Pinsonneault-Thibeault , Konstantin Komarov , Sasha Levin Subject: [PATCH 6.18 057/614] ntfs3: fix uninit memory after failed mi_read in mi_format_new Date: Tue, 16 Dec 2025 12:07:04 +0100 Message-ID: <20251216111403.376456907@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251216111401.280873349@linuxfoundation.org> References: <20251216111401.280873349@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Raphael Pinsonneault-Thibeault [ Upstream commit 73e6b9dacf72a1e7a4265eacca46f8f33e0997d6 ] Fix a KMSAN un-init bug found by syzkaller. ntfs_get_bh() expects a buffer from sb_getblk(), that buffer may not be uptodate. We do not bring the buffer uptodate before setting it as uptodate. If the buffer were to not be uptodate, it could mean adding a buffer with un-init data to the mi record. Attempting to load that record will trigger KMSAN. Avoid this by setting the buffer as uptodate, if it’s not already, by overwriting it. Reported-by: syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7a2ba6b7b66340cff225 Tested-by: syzbot+7a2ba6b7b66340cff225@syzkaller.appspotmail.com Fixes: 4342306f0f0d5 ("fs/ntfs3: Add file operations and implementation") Signed-off-by: Raphael Pinsonneault-Thibeault Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/fsntfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c index c7a2f191254da..5ae910e9ecbda 100644 --- a/fs/ntfs3/fsntfs.c +++ b/fs/ntfs3/fsntfs.c @@ -1349,7 +1349,14 @@ int ntfs_get_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo, } if (buffer_locked(bh)) __wait_on_buffer(bh); - set_buffer_uptodate(bh); + + lock_buffer(bh); + if (!buffer_uptodate(bh)) + { + memset(bh->b_data, 0, blocksize); + set_buffer_uptodate(bh); + } + unlock_buffer(bh); } else { bh = ntfs_bread(sb, block); if (!bh) { -- 2.51.0