summaryrefslogtreecommitdiffstats
path: root/fs/ntfs3/bitmap.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2022-10-02 16:39:15 +0200
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2022-11-12 18:59:41 +0100
commit0d0f659bf713662fabed973f9996b8f23c59ca51 (patch)
treeb3b161ea5e7d81e8c26fed11c127712299cf37b5 /fs/ntfs3/bitmap.c
parentfs/ntfs3: Fix slab-out-of-bounds read in ntfs_trim_fs (diff)
downloadlinux-0d0f659bf713662fabed973f9996b8f23c59ca51.tar.xz
linux-0d0f659bf713662fabed973f9996b8f23c59ca51.zip
fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init()
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 [1] 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>
Diffstat (limited to '')
-rw-r--r--fs/ntfs3/bitmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index 629c1ee97268..badaaaf302dd 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -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;