vhost-vdpa: Add qemu_close in vhost_vdpa_cleanup

fix the bug that fd will still open after the cleanup

Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20201016030909.9522-1-lulu@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Cindy Lu 2020-10-16 11:09:08 +08:00 committed by Michael S. Tsirkin
parent 1b296c3def
commit 57b3a7d81b

View File

@ -145,6 +145,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc)
g_free(s->vhost_net); g_free(s->vhost_net);
s->vhost_net = NULL; s->vhost_net = NULL;
} }
if (s->vhost_vdpa.device_fd >= 0) {
qemu_close(s->vhost_vdpa.device_fd);
s->vhost_vdpa.device_fd = -1;
}
} }
static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc) static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc)