[Devel] [PATCH rh7] ext4: fix file allocation check in ext4_open_balloon

Konstantin Khorenko khorenko at virtuozzo.com
Thu Nov 12 01:41:18 PST 2015


Checked, 2.6.32-x does not need it.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 11/11/2015 08:56 PM, Stanislav Kinsburskiy wrote:
> Function alloc_file() doesn't return NULL. It returns error pointer.
> File structure allocation may fail before file->f_ep_links is initialized,
> which may lead to crash in eventpoll_release_file().
>
> https://jira.sw.ru/browse/PSBM-41222
>
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>   fs/ext4/ioctl.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index d94aa19..05af494 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -234,9 +234,10 @@ static int ext4_open_balloon(struct super_block *sb, struct vfsmount *mnt)
>   			&ext4_file_operations);
>   	if (mode & FMODE_WRITE)
>   		mnt_drop_write(path.mnt);
> -	err = -ENOMEM;
> -	if (filp == NULL)
> +	if (IS_ERR(filp)) {
> +		err = PTR_ERR(filp);
>   		goto err_filp;
> +	}
>
>   	filp->f_flags |= O_LARGEFILE;
>   	fd_install(fd, filp);
>
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
>


More information about the Devel mailing list