Эх сурвалжийг харах

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>
Chengguang Xu 7 жил өмнө
parent
commit
21ac738ede
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      fs/ext4/super.c

+ 3 - 0
fs/ext4/super.c

@@ -5101,6 +5101,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 #endif
 #endif
 	char *orig_data = kstrdup(data, GFP_KERNEL);
 	char *orig_data = kstrdup(data, GFP_KERNEL);
 
 
+	if (data && !orig_data)
+		return -ENOMEM;
+
 	/* Store the original options */
 	/* Store the original options */
 	old_sb_flags = sb->s_flags;
 	old_sb_flags = sb->s_flags;
 	old_opts.s_mount_opt = sbi->s_mount_opt;
 	old_opts.s_mount_opt = sbi->s_mount_opt;