]> git.itanic.dy.fi Git - linux-stable/commitdiff
fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init()
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sun, 2 Oct 2022 14:39:15 +0000 (23:39 +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 wnd_init() [1], for a crafted
filesystem can become wnd->nwnd close to UINT_MAX. Add __GFP_NOWARN in
order to avoid too large allocation warning, than exhausting memory by
using kvcalloc().

Link: https://syzkaller.appspot.com/bug?extid=fa4648a5446460b7b963
Reported-by: syzot <syzbot+fa4648a5446460b7b963@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/bitmap.c

index 629c1ee97268a1ab3ed781b5bff0178ca8c6b09f..badaaaf302ddfc99069f8ffe68022705cec78ee5 100644 (file)
@@ -661,7 +661,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
        if (!wnd->bits_last)
                wnd->bits_last = wbits;
 
-       wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS);
+       wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS | __GFP_NOWARN);
        if (!wnd->free_bits)
                return -ENOMEM;