]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs/ntfs3: Initialize new folios before use
authorBartlomiej Kubik <kubik.bartlomiej@gmail.com>
Wed, 26 Nov 2025 22:02:51 +0000 (23:02 +0100)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Fri, 19 Dec 2025 18:03:57 +0000 (19:03 +0100)
KMSAN reports an uninitialized value in longest_match_std(), invoked
from ntfs_compress_write(). When new folios are allocated without being
marked uptodate and ni_read_frame() is skipped because the caller expects
the frame to be completely overwritten, some reserved folios may remain
only partially filled, leaving the rest memory uninitialized.

Fixes: 584f60ba22f7 ("ntfs3: Convert ntfs_get_frame_pages() to use a folio")
Tested-by: syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com
Reported-by: syzbot+08d8956768c96a2c52cf@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=08d8956768c96a2c52cf
Signed-off-by: Bartlomiej Kubik <kubik.bartlomiej@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/file.c

index 2e7b2e566ebe18c173319c7cfd4304c22ddd2f28..732260087066d7d81f8fabc8742953b602c216bb 100644 (file)
@@ -995,7 +995,7 @@ static int ntfs_get_frame_pages(struct address_space *mapping, pgoff_t index,
 
                folio = __filemap_get_folio(mapping, index,
                                            FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
-                                           gfp_mask);
+                                           gfp_mask | __GFP_ZERO);
                if (IS_ERR(folio)) {
                        while (npages--) {
                                folio = page_folio(pages[npages]);