Re: [syzbot] [ntfs3?] KMSAN: uninit-value in ntfs_read_bh

Suraj Sonawane
2024-11-05T13:33:23Z

[-- Attachment #1.1: Type: text/plain, Size: 10 bytes --]

#syz test

[-- Attachment #1.2: Type: text/html, Size: 42 bytes --]

[-- Attachment #2: 0001-fs-ntfs3-fix-uninit-value-in-ntfs_read_bh.patch --]
[-- Type: text/x-patch, Size: 823 bytes --]

From 9fb026cb33fba809fe23eb18f997140021f1bd84 Mon Sep 17 00:00:00 2001
From: Suraj Sonawane <surajsonawane0215@gmail.com>
Date: Tue, 5 Nov 2024 18:46:57 +0530
Subject: [PATCH] fs: ntfs3: fix uninit-value in ntfs_read_bh

syz test

Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
---
fs/ntfs3/fsntfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 0fa636038..af5ba7378 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -1312,8 +1312,10 @@ int ntfs_read_bh(struct ntfs_sb_info *sbi, const struct runs_tree *run, u64 vbo,
{
int err = ntfs_read_run_nb(sbi, run, vbo, rhdr, bytes, nb);

- if (err)
+ if (err) {
+ memset(rhdr, 0, sizeof(*rhdr));
return err;
+ }
return ntfs_fix_post_read(rhdr, nb->bytes, true);
}

--
2.34.1