summaryrefslogtreecommitdiff
path: root/fs/ext2/ioctl.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@mykernel.net>2019-10-23 21:56:43 +0800
committerJan Kara <jack@suse.cz>2019-10-24 09:24:40 +0200
commitacd1f04679803af84e7ab76f37df30d8598b07b9 (patch)
tree56b9db6cac3d11df1dcc1d48e36f98dc33cc2cef /fs/ext2/ioctl.c
parentba1af2e47446ac353395b4c274408944284ceeaa (diff)
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>
Diffstat (limited to 'fs/ext2/ioctl.c')
-rw-r--r--fs/ext2/ioctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index 1b853fb0b163..32a8d10b579d 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -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;