| From 266fe65acab12925f6ae004c2db92141100039cd Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Wed, 26 Nov 2025 23:02:51 +0100 |
| Subject: fs/ntfs3: Initialize new folios before use |
| |
| From: Bartlomiej Kubik <kubik.bartlomiej@gmail.com> |
| |
| [ Upstream commit f223ebffa185cc8da934333c5a31ff2d4f992dc9 ] |
| |
| 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> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| fs/ntfs3/file.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c |
| index 83f0072f0896c..3e61eaf28e088 100644 |
| --- a/fs/ntfs3/file.c |
| +++ b/fs/ntfs3/file.c |
| @@ -930,7 +930,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]); |
| -- |
| 2.51.0 |
| |