* [PATCH] fs/ntfs3: Initialize new folios before use
@ 2025-11-26 22:02 Bartlomiej Kubik
2025-12-09 13:37 ` Konstantin Komarov
0 siblings, 1 reply; 2+ messages in thread
From: Bartlomiej Kubik @ 2025-11-26 22:02 UTC (permalink / raw)
To: almaz.alexandrovich
Cc: ntfs3, linux-kernel, david.hunter.linux, skhan, khalid,
linux-kernel-mentees, Bartlomiej Kubik,
syzbot+08d8956768c96a2c52cf
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>
---
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 4c90ec2fa2ea..00df27876c50 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.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs/ntfs3: Initialize new folios before use
2025-11-26 22:02 [PATCH] fs/ntfs3: Initialize new folios before use Bartlomiej Kubik
@ 2025-12-09 13:37 ` Konstantin Komarov
0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Komarov @ 2025-12-09 13:37 UTC (permalink / raw)
To: Bartlomiej Kubik
Cc: ntfs3, linux-kernel, david.hunter.linux, skhan, khalid,
linux-kernel-mentees, syzbot+08d8956768c96a2c52cf
On 11/26/25 23:02, Bartlomiej Kubik wrote:
> 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>
> ---
> 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 4c90ec2fa2ea..00df27876c50 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.39.5
>
Queued for the next merge window, thanks.
Regards,
Konstantin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-09 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26 22:02 [PATCH] fs/ntfs3: Initialize new folios before use Bartlomiej Kubik
2025-12-09 13:37 ` Konstantin Komarov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox