@@ -53,7 +53,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr)
if (!attr->non_res) {
lsize = le32_to_cpu(attr->res.data_size);
/* attr is resident: lsize < record_size (1K or 4K) */
- le = kvmalloc(al_aligned(lsize), GFP_KERNEL);
+ le = kvmalloc(al_aligned(lsize), GFP_KERNEL | __GFP_NOWARN);
if (!le) {
err = -ENOMEM;
goto out;
@@ -91,7 +91,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr)
* the result is 16M bytes per attribute list.
* Use kvmalloc to allocate in range [several Kbytes - dozen Mbytes]
*/
- le = kvmalloc(al_aligned(lsize), GFP_KERNEL);
+ le = kvmalloc(al_aligned(lsize), GFP_KERNEL | __GFP_NOWARN);
if (!le) {
err = -ENOMEM;
goto out;
@@ -660,7 +660,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
wnd->bits_last = wbits;
wnd->free_bits =
- kvmalloc_array(wnd->nwnd, sizeof(u16), GFP_KERNEL | __GFP_ZERO);
+ kvmalloc_array(wnd->nwnd, sizeof(u16), GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN);
if (!wnd->free_bits)
return -ENOMEM;
@@ -1413,7 +1413,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
}
bytes = inode->i_size;
- sbi->def_table = t = kvmalloc(bytes, GFP_KERNEL);
+ sbi->def_table = t = kvmalloc(bytes, GFP_KERNEL | __GFP_NOWARN);
if (!t) {
err = -ENOMEM;
goto put_inode_out;
kvmalloc needs to check __GFP_NOWARN, so this flag should be passed before applying for memory. Fixes: fc471e39e38f ("fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN)") Reported-and-tested-by: syzbot+f987ceaddc6bcc334cde@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <eadavis@qq.com> --- fs/ntfs3/attrlist.c | 4 ++-- fs/ntfs3/bitmap.c | 2 +- fs/ntfs3/super.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)