Commit 6e58fc14 authored by Jia-Ye Li's avatar Jia-Ye Li Committed by Greg Kroah-Hartman

staging: exfat: Use kvzalloc() instead of kzalloc() for exfat_sb_info

Fix mount failed "Cannot allocate memory".

When the memory gets fragmented, kzalloc() might fail to allocate
physically contiguous pages for the struct exfat_sb_info (its size is
about 34KiB) even the total free memory is enough.
Use kvzalloc() to solve this problem.
Reviewed-by: default avatarEthan Wu <ethanwu@synology.com>
Signed-off-by: default avatarJia-Ye Li <jiayeli@synology.com>
Link: https://lore.kernel.org/r/20190925083729.4653-1-jiayeli@synology.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5bdea606
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mm.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/mpage.h> #include <linux/mpage.h>
...@@ -3450,7 +3451,7 @@ static void exfat_free_super(struct exfat_sb_info *sbi) ...@@ -3450,7 +3451,7 @@ static void exfat_free_super(struct exfat_sb_info *sbi)
kfree(sbi->options.iocharset); kfree(sbi->options.iocharset);
/* mutex_init is in exfat_fill_super function. only for 3.7+ */ /* mutex_init is in exfat_fill_super function. only for 3.7+ */
mutex_destroy(&sbi->s_lock); mutex_destroy(&sbi->s_lock);
kfree(sbi); kvfree(sbi);
} }
static void exfat_put_super(struct super_block *sb) static void exfat_put_super(struct super_block *sb)
...@@ -3845,7 +3846,7 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent) ...@@ -3845,7 +3846,7 @@ static int exfat_fill_super(struct super_block *sb, void *data, int silent)
* the filesystem, since we're only just about to mount * the filesystem, since we're only just about to mount
* it and have no inodes etc active! * it and have no inodes etc active!
*/ */
sbi = kzalloc(sizeof(struct exfat_sb_info), GFP_KERNEL); sbi = kvzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi) if (!sbi)
return -ENOMEM; return -ENOMEM;
mutex_init(&sbi->s_lock); mutex_init(&sbi->s_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment