summaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-07-29 21:51:54 +0200
committerTheodore Ts'o <tytso@mit.edu>2018-07-29 21:51:54 +0200
commit21ac738ede0b49004b53b4a44fe3df7bb4a78280 (patch)
treeed972023ca57033a550f2d2a36a0d5cfea51ddaf /fs/ext4/super.c
parentext4: fix warning message in ext4_enable_quotas() (diff)
downloadlinux-21ac738ede0b49004b53b4a44fe3df7bb4a78280.tar.xz
linux-21ac738ede0b49004b53b4a44fe3df7bb4a78280.zip
ext4: check allocation failure when duplicating "data" in ext4_remount()
There is no check for allocation failure when duplicating "data" in ext4_remount(). Check for failure and return error -ENOMEM in this case. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3e64d8d51ac4..d4a218ba626c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5101,6 +5101,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
#endif
char *orig_data = kstrdup(data, GFP_KERNEL);
+ if (data && !orig_data)
+ return -ENOMEM;
+
/* Store the original options */
old_sb_flags = sb->s_flags;
old_opts.s_mount_opt = sbi->s_mount_opt;