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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 1 Feb 2021 13:47:08 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>,
        virtualization@...ts.linux-foundation.org
Cc:     Xie Yongji <xieyongji@...edance.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Laurent Vivier <lvivier@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        linux-kernel@...r.kernel.org, Max Gurtovoy <mgurtovoy@...dia.com>,
        kvm@...r.kernel.org
Subject: Re: [PATCH RFC v2 06/10] vdpa_sim: cleanup kiovs in vdpasim_free()


On 2021/1/28 下午10:41, Stefano Garzarella wrote:
> vringh_getdesc_iotlb() allocates memory to store the kvec, that
> is freed with vringh_kiov_cleanup().
>
> vringh_getdesc_iotlb() is able to reuse a kvec previously allocated,
> so in order to avoid to allocate the kvec for each request, we are
> not calling vringh_kiov_cleanup() when we finished to handle a
> request, but we should call it when we free the entire device.
>
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>


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


> ---
>   drivers/vdpa/vdpa_sim/vdpa_sim.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index 53238989713d..a7aeb5d01c3e 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -562,8 +562,15 @@ static int vdpasim_dma_unmap(struct vdpa_device *vdpa, u64 iova, u64 size)
>   static void vdpasim_free(struct vdpa_device *vdpa)
>   {
>   	struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
> +	int i;
>   
>   	cancel_work_sync(&vdpasim->work);
> +
> +	for (i = 0; i < vdpasim->dev_attr.nvqs; i++) {
> +		vringh_kiov_cleanup(&vdpasim->vqs[i].out_iov);
> +		vringh_kiov_cleanup(&vdpasim->vqs[i].in_iov);
> +	}
> +
>   	put_iova_domain(&vdpasim->iova);
>   	iova_cache_put();
>   	kvfree(vdpasim->buffer);

Powered by blists - more mailing lists