ext2: return error when fail to allocating memory in ioctl

Currently, we do not check memory allocation
result for ei->i_block_alloc_info in ioctl,
this patch checks it and returns error in
failure case.

Link: https://lore.kernel.org/r/20191023135643.28837-1-cgxu519@mykernel.net
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Chengguang Xu 2019-10-23 21:56:43 +08:00 committed by Jan Kara
parent ba1af2e474
commit acd1f04679
1 changed files with 4 additions and 1 deletions

View File

@ -145,10 +145,13 @@ setversion_out:
if (ei->i_block_alloc_info){
struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node;
rsv->rsv_goal_size = rsv_window_size;
} else {
ret = -ENOMEM;
}
mutex_unlock(&ei->truncate_mutex);
mnt_drop_write_file(filp);
return 0;
return ret;
}
default:
return -ENOTTY;