[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vdpa: Fix file descriptor leak on get features error

From: Laurent Vivier
Subject: Re: [PATCH] vdpa: Fix file descriptor leak on get features error
Date: Mon, 1 Aug 2022 20:31:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 01/08/2022 16:47, Eugenio Pérez wrote:
File descriptor vdpa_device_fd is not free in the case of returning
error from vhost_vdpa_get_features. Fixing it by making all errors go to
the same error path.

Resolves: Coverity CID 1490785
Fixes: 8170ab3f43 ("vdpa: Extract get features part from 

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
  net/vhost-vdpa.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 6abad276a6..303447a68e 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -566,7 +566,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char 
      g_autofree NetClientState **ncs = NULL;
      g_autoptr(VhostIOVATree) iova_tree = NULL;
      NetClientState *nc;
-    int queue_pairs, r, i, has_cvq = 0;
+    int queue_pairs, r, i = 0, has_cvq = 0;
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
      opts = &netdev->u.vhost_vdpa;
@@ -582,7 +582,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char 
r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp);
      if (unlikely(r < 0)) {
-        return r;
+        goto err;

Why don't you use "goto err_svq"?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]