From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 30 Jan 2023 14:09:57 -0500 From: "Michael S. Tsirkin" Message-ID: <20230130140947-mutt-send-email-mst@kernel.org> References: <20230130140225.77964-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 In-Reply-To: <20230130140225.77964-1-akihiko.odaki@daynix.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Re: [Virtio-fs] [PATCH] vhost-user-fs: Back up vqs before cleaning up vhost_dev List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Akihiko Odaki Cc: "Dr. David Alan Gilbert" , Stefan Hajnoczi , virtio-fs@redhat.com, qemu-devel@nongnu.org On Mon, Jan 30, 2023 at 11:02:25PM +0900, Akihiko Odaki wrote: > vhost_dev_cleanup() clears vhost_dev so back up its vqs member to free > the memory pointed by the member. > > Fixes: 98fc1ada4c ("virtio: add vhost-user-fs base device") > Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin > --- > hw/virtio/vhost-user-fs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c > index f5049735ac..83fc20e49e 100644 > --- a/hw/virtio/vhost-user-fs.c > +++ b/hw/virtio/vhost-user-fs.c > @@ -273,6 +273,7 @@ static void vuf_device_unrealize(DeviceState *dev) > { > VirtIODevice *vdev = VIRTIO_DEVICE(dev); > VHostUserFS *fs = VHOST_USER_FS(dev); > + struct vhost_virtqueue *vhost_vqs = fs->vhost_dev.vqs; > int i; > > /* This will stop vhost backend if appropriate. */ > @@ -288,8 +289,7 @@ static void vuf_device_unrealize(DeviceState *dev) > } > g_free(fs->req_vqs); > virtio_cleanup(vdev); > - g_free(fs->vhost_dev.vqs); > - fs->vhost_dev.vqs = NULL; > + g_free(vhost_vqs); > } > > static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev) > -- > 2.39.1