|
|
586cba |
From 71857062b7aea29fc418e107244cf4083cd78cd7 Mon Sep 17 00:00:00 2001
|
|
|
586cba |
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
|
586cba |
Date: Tue, 2 Aug 2022 13:24:46 +0200
|
|
|
586cba |
Subject: [PATCH 11/11] vdpa: Fix file descriptor leak on get features error
|
|
|
586cba |
MIME-Version: 1.0
|
|
|
586cba |
Content-Type: text/plain; charset=UTF-8
|
|
|
586cba |
Content-Transfer-Encoding: 8bit
|
|
|
586cba |
|
|
|
586cba |
RH-Author: Eugenio Pérez <eperezma@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree
|
|
|
586cba |
RH-Commit: [4/4] bdfe6ed4539ecf68dc8bc4519755f9d5c096447d (eperezmartin/qemu-kvm)
|
|
|
586cba |
RH-Bugzilla: 2116876
|
|
|
586cba |
RH-Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
586cba |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
586cba |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
586cba |
|
|
|
586cba |
File descriptor vdpa_device_fd is not free in the case of returning
|
|
|
586cba |
error from vhost_vdpa_get_features. Fixing it by making all errors go to
|
|
|
586cba |
the same error path.
|
|
|
586cba |
|
|
|
586cba |
Resolves: Coverity CID 1490785
|
|
|
586cba |
Fixes: 8170ab3f43 ("vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs")
|
|
|
586cba |
|
|
|
586cba |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
|
586cba |
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
586cba |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
586cba |
Message-Id: <20220802112447.249436-2-eperezma@redhat.com>
|
|
|
586cba |
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
|
|
586cba |
(cherry picked from commit aed5da45daf734ddc543c0791e877dac75e16f61)
|
|
|
586cba |
---
|
|
|
586cba |
net/vhost-vdpa.c | 4 ++--
|
|
|
586cba |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
586cba |
|
|
|
586cba |
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
|
|
586cba |
index 50672bcd66..411e71e6c2 100644
|
|
|
586cba |
--- a/net/vhost-vdpa.c
|
|
|
586cba |
+++ b/net/vhost-vdpa.c
|
|
|
586cba |
@@ -566,7 +566,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
|
|
|
586cba |
g_autofree NetClientState **ncs = NULL;
|
|
|
586cba |
g_autoptr(VhostIOVATree) iova_tree = NULL;
|
|
|
586cba |
NetClientState *nc;
|
|
|
586cba |
- int queue_pairs, r, i, has_cvq = 0;
|
|
|
586cba |
+ int queue_pairs, r, i = 0, has_cvq = 0;
|
|
|
586cba |
|
|
|
586cba |
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
|
|
|
586cba |
opts = &netdev->u.vhost_vdpa;
|
|
|
586cba |
@@ -582,7 +582,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
|
|
|
586cba |
|
|
|
586cba |
r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp);
|
|
|
586cba |
if (unlikely(r < 0)) {
|
|
|
586cba |
- return r;
|
|
|
586cba |
+ goto err;
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
|
|
|
586cba |
--
|
|
|
586cba |
2.31.1
|
|
|
586cba |
|