summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2019-01-01 08:30:28 -0500
committerJan Kara <jack@suse.cz>2019-01-22 05:38:15 -0500
commit6a03e6a8dcf573dcb1621b50d6bfd2e1fa2bd8c0 (patch)
treee2eeccbd3a83b850cc804363de51621981aa2ed5
parent49a57857aeea06ca831043acbb0fa5e0f50602fd (diff)
ext2: set proper return code
Set proper return code when failing from allocating memory in ext2_fill_super(). Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/ext2/super.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 73b2d528237f..b6d8402f5c62 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1087,12 +1087,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
1087 sizeof(struct buffer_head *), 1087 sizeof(struct buffer_head *),
1088 GFP_KERNEL); 1088 GFP_KERNEL);
1089 if (sbi->s_group_desc == NULL) { 1089 if (sbi->s_group_desc == NULL) {
1090 ret = -ENOMEM;
1090 ext2_msg(sb, KERN_ERR, "error: not enough memory"); 1091 ext2_msg(sb, KERN_ERR, "error: not enough memory");
1091 goto failed_mount; 1092 goto failed_mount;
1092 } 1093 }
1093 bgl_lock_init(sbi->s_blockgroup_lock); 1094 bgl_lock_init(sbi->s_blockgroup_lock);
1094 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); 1095 sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL);
1095 if (!sbi->s_debts) { 1096 if (!sbi->s_debts) {
1097 ret = -ENOMEM;
1096 ext2_msg(sb, KERN_ERR, "error: not enough memory"); 1098 ext2_msg(sb, KERN_ERR, "error: not enough memory");
1097 goto failed_mount_group_desc; 1099 goto failed_mount_group_desc;
1098 } 1100 }
@@ -1148,6 +1150,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
1148#ifdef CONFIG_EXT2_FS_XATTR 1150#ifdef CONFIG_EXT2_FS_XATTR
1149 sbi->s_ea_block_cache = ext2_xattr_create_cache(); 1151 sbi->s_ea_block_cache = ext2_xattr_create_cache();
1150 if (!sbi->s_ea_block_cache) { 1152 if (!sbi->s_ea_block_cache) {
1153 ret = -ENOMEM;
1151 ext2_msg(sb, KERN_ERR, "Failed to create ea_block_cache"); 1154 ext2_msg(sb, KERN_ERR, "Failed to create ea_block_cache");
1152 goto failed_mount3; 1155 goto failed_mount3;
1153 } 1156 }