Commit acd1f046 authored by Chengguang Xu's avatar Chengguang Xu Committed by Jan Kara

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.netSigned-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent ba1af2e4
...@@ -145,10 +145,13 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -145,10 +145,13 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (ei->i_block_alloc_info){ if (ei->i_block_alloc_info){
struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node; struct ext2_reserve_window_node *rsv = &ei->i_block_alloc_info->rsv_window_node;
rsv->rsv_goal_size = rsv_window_size; rsv->rsv_goal_size = rsv_window_size;
} else {
ret = -ENOMEM;
} }
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
mnt_drop_write_file(filp); mnt_drop_write_file(filp);
return 0; return ret;
} }
default: default:
return -ENOTTY; return -ENOTTY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment