add patch check-for-valid-e_name_len-in-xattr-entries
[ext4-patch-queue.git] / check-allocation-failure-when-duplicating-data-in-ext4_remount
blob177d48f0893241bfc89e9c8bb51294d8135892c0
1 ext4: check allocation failure when duplicating "data" in ext4_remount()
3 From: Chengguang Xu <cgxu519@gmx.com>
5 There is no check for allocation failure when duplicating
6 "data" in ext4_remount(). Check for failure and return
7 error -ENOMEM in this case.
9 Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 Reviewed-by: Andreas Dilger <adilger@dilger.ca>
12 ---
13 v2:
14 - Modify changelog for easy understading.
16  fs/ext4/super.c | 3 +++
17  1 file changed, 3 insertions(+)
19 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
20 index 0c4c2201b3aa..f9c3da513cae 100644
21 --- a/fs/ext4/super.c
22 +++ b/fs/ext4/super.c
23 @@ -5014,6 +5014,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
24  #endif
25         char *orig_data = kstrdup(data, GFP_KERNEL);
27 +       if (data && !orig_data)
28 +               return -ENOMEM;
30         /* Store the original options */
31         old_sb_flags = sb->s_flags;
32         old_opts.s_mount_opt = sbi->s_mount_opt;
33 -- 
34 2.17.1