]> git.itanic.dy.fi Git - linux-stable/commitdiff
fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_fill_super()
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sun, 2 Oct 2022 14:54:11 +0000 (23:54 +0900)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Sat, 12 Nov 2022 17:59:41 +0000 (20:59 +0300)
syzbot is reporting too large allocation at ntfs_fill_super() [1], for a
crafted filesystem can contain bogus inode->i_size. Add __GFP_NOWARN in
order to avoid too large allocation warning, than exhausting memory by
using kvmalloc().

Link: https://syzkaller.appspot.com/bug?extid=33f3faaa0c08744f7d40
Reported-by: syzot <syzbot+33f3faaa0c08744f7d40@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/super.c

index 1e2c04e48f98f3fdc6a57ae55f72f93cbcacbaec..2fd1367a59820e28e9fd89db0d46a60577cc999f 100644 (file)
@@ -1167,7 +1167,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
                goto put_inode_out;
        }
        bytes = inode->i_size;
-       sbi->def_table = t = kmalloc(bytes, GFP_NOFS);
+       sbi->def_table = t = kmalloc(bytes, GFP_NOFS | __GFP_NOWARN);
        if (!t) {
                err = -ENOMEM;
                goto put_inode_out;