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.
Signed-off-by: Chengguang Xu <[email protected]>
---
fs/ext2/ioctl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
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;
--
2.21.0
On Wed 23-10-19 21:56:43, Chengguang Xu wrote:
> 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.
>
> Signed-off-by: Chengguang Xu <[email protected]>
Makes sense. Applied. Thanks!
Honza
> ---
> fs/ext2/ioctl.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
> 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;
> --
> 2.21.0
>
>
>
--
Jan Kara <[email protected]>
SUSE Labs, CR