lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a5eac458-eed7-df75-66ac-0a8349ad09b0@redhat.com>
Date:   Fri, 12 Mar 2021 14:34:07 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>,
        virtualization@...ts.linux-foundation.org
Cc:     netdev@...r.kernel.org, Zhu Lingshan <lingshan.zhu@...el.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH 2/2] vhost-vdpa: set v->config_ctx to NULL if
 eventfd_ctx_fdget() fails


On 2021/3/11 9:52 下午, Stefano Garzarella wrote:
> In vhost_vdpa_set_config_call() if eventfd_ctx_fdget() fails the
> 'v->config_ctx' contains an error instead of a valid pointer.
>
> Since we consider 'v->config_ctx' valid if it is not NULL, we should
> set it to NULL in this case to avoid to use an invalid pointer in
> other functions such as vhost_vdpa_config_put().
>
> Fixes: 776f395004d8 ("vhost_vdpa: Support config interrupt in vdpa")
> Cc: lingshan.zhu@...el.com
> Cc: stable@...r.kernel.org
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>


Acked-by: Jason Wang <jasowang@...hat.com>


> ---
>   drivers/vhost/vdpa.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 00796e4ecfdf..f9ecdce5468a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -331,8 +331,12 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp)
>   	if (!IS_ERR_OR_NULL(ctx))
>   		eventfd_ctx_put(ctx);
>   
> -	if (IS_ERR(v->config_ctx))
> -		return PTR_ERR(v->config_ctx);
> +	if (IS_ERR(v->config_ctx)) {
> +		long ret = PTR_ERR(v->config_ctx);
> +
> +		v->config_ctx = NULL;
> +		return ret;
> +	}
>   
>   	v->vdpa->config->set_config_cb(v->vdpa, &cb);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ