summaryrefslogtreecommitdiff
path: root/net/vhost-vdpa.c
diff options
context:
space:
mode:
authorCindy Lu <lulu@redhat.com>2020-10-16 11:09:08 +0800
committerMichael S. Tsirkin <mst@redhat.com>2020-11-03 16:39:05 -0500
commit57b3a7d81bd7b5fb846ab5c05597a853259a1853 (patch)
treec7fde90772d4c6bfc37686663f5c7f57ba359e20 /net/vhost-vdpa.c
parent1b296c3def4b9b63d2fdbce6646edd108a3e616c (diff)
downloadqemu-57b3a7d81bd7b5fb846ab5c05597a853259a1853.zip
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>
Diffstat (limited to 'net/vhost-vdpa.c')
-rw-r--r--net/vhost-vdpa.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 99c476db8c..fe659ec9e2 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -145,6 +145,10 @@ static void vhost_vdpa_cleanup(NetClientState *nc)
g_free(s->vhost_net);
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)