All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] vdpa: Merge all net_init_vhost_vdpa error goto
@ 2022-08-02 11:24 Eugenio Pérez
  2022-08-02 11:24 ` [PATCH 1/2] vdpa: Fix file descriptor leak on get features error Eugenio Pérez
  2022-08-02 11:24 ` [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
  0 siblings, 2 replies; 10+ messages in thread
From: Eugenio Pérez @ 2022-08-02 11:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, qemu-trivial, Jason Wang,
	Michael S . Tsirkin

Few steps allocate new resources, and all of the allocated can be
checked to avoid trying to free an invalid one.

This series includes an already posted patch [1], because it must be applied
on top of that.

[1] https://lists.nongnu.org/archive/html/qemu-devel/2022-08/msg00089.html

Eugenio Pérez (2):
  vdpa: Fix file descriptor leak on get features error
  vdpa: Merge all net_init_vhost_vdpa error goto

 net/vhost-vdpa.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] vdpa: Fix file descriptor leak on get features error
  2022-08-02 11:24 [PATCH 0/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
@ 2022-08-02 11:24 ` Eugenio Pérez
  2022-08-02 12:07   ` Laurent Vivier
  2022-08-02 11:24 ` [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
  1 sibling, 1 reply; 10+ messages in thread
From: Eugenio Pérez @ 2022-08-02 11:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, qemu-trivial, Jason Wang,
	Michael S . Tsirkin

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 vhost_vdpa_get_max_queue_pairs")

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 *name,
     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 *name,
 
     r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp);
     if (unlikely(r < 0)) {
-        return r;
+        goto err;
     }
 
     queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 11:24 [PATCH 0/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
  2022-08-02 11:24 ` [PATCH 1/2] vdpa: Fix file descriptor leak on get features error Eugenio Pérez
@ 2022-08-02 11:24 ` Eugenio Pérez
  2022-08-02 12:10   ` Laurent Vivier
  1 sibling, 1 reply; 10+ messages in thread
From: Eugenio Pérez @ 2022-08-02 11:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Peter Maydell, qemu-trivial, Jason Wang,
	Michael S . Tsirkin

Few steps allocate new resources, and all of the allocated can be
checked to avoid trying to free an invalid one.

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

diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 303447a68e..ac1810723c 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
     queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
                                                  &has_cvq, errp);
     if (queue_pairs < 0) {
-        qemu_close(vdpa_device_fd);
-        return queue_pairs;
+        goto err;
     }
 
     if (opts->x_svq) {
@@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
         if (invalid_dev_features) {
             error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
                        invalid_dev_features);
-            goto err_svq;
+            goto err;
         }
 
         vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
@@ -640,7 +639,6 @@ err:
         }
     }
 
-err_svq:
     qemu_close(vdpa_device_fd);
 
     return -1;
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] vdpa: Fix file descriptor leak on get features error
  2022-08-02 11:24 ` [PATCH 1/2] vdpa: Fix file descriptor leak on get features error Eugenio Pérez
@ 2022-08-02 12:07   ` Laurent Vivier
  2022-08-02 12:56     ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2022-08-02 12:07 UTC (permalink / raw)
  To: Eugenio Pérez, qemu-devel
  Cc: Peter Maydell, qemu-trivial, Jason Wang, Michael S . Tsirkin

On 02/08/2022 13:24, 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 vhost_vdpa_get_max_queue_pairs")
> 
> 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 *name,
>       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 *name,
>   
>       r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp);
>       if (unlikely(r < 0)) {
> -        return r;
> +        goto err;
>       }
>   
>       queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,

Reviewed-by: Laurent Vivier <lvivier@redhat.com>

I can take this one via the trivial branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 11:24 ` [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
@ 2022-08-02 12:10   ` Laurent Vivier
  2022-08-02 12:57     ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2022-08-02 12:10 UTC (permalink / raw)
  To: Eugenio Pérez, qemu-devel
  Cc: Peter Maydell, qemu-trivial, Jason Wang, Michael S . Tsirkin

On 02/08/2022 13:24, Eugenio Pérez wrote:
> Few steps allocate new resources, and all of the allocated can be
> checked to avoid trying to free an invalid one.
> 
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>   net/vhost-vdpa.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 303447a68e..ac1810723c 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>       queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
>                                                    &has_cvq, errp);
>       if (queue_pairs < 0) {
> -        qemu_close(vdpa_device_fd);
> -        return queue_pairs;
> +        goto err;
>       }
>   
>       if (opts->x_svq) {
> @@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>           if (invalid_dev_features) {
>               error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
>                          invalid_dev_features);
> -            goto err_svq;
> +            goto err;
>           }
>   
>           vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
> @@ -640,7 +639,6 @@ err:
>           }
>       }
>   
> -err_svq:
>       qemu_close(vdpa_device_fd);
>   
>       return -1;

Reviewed-by: Laurent Vivier <lvivier@redhat.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] vdpa: Fix file descriptor leak on get features error
  2022-08-02 12:07   ` Laurent Vivier
@ 2022-08-02 12:56     ` Michael S. Tsirkin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2022-08-02 12:56 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Eugenio Pérez, qemu-devel, Peter Maydell, qemu-trivial, Jason Wang

On Tue, Aug 02, 2022 at 02:07:04PM +0200, Laurent Vivier wrote:
> On 02/08/2022 13:24, 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 vhost_vdpa_get_max_queue_pairs")
> > 
> > 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 *name,
> >       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 *name,
> >       r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp);
> >       if (unlikely(r < 0)) {
> > -        return r;
> > +        goto err;
> >       }
> >       queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
> 
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> 
> I can take this one via the trivial branch.
> 
> Thanks,
> Laurent

Not sure why it's appropriate for trivial but sure if you like

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 12:10   ` Laurent Vivier
@ 2022-08-02 12:57     ` Michael S. Tsirkin
  2022-08-02 12:58       ` Laurent Vivier
  0 siblings, 1 reply; 10+ messages in thread
From: Michael S. Tsirkin @ 2022-08-02 12:57 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Eugenio Pérez, qemu-devel, Peter Maydell, qemu-trivial, Jason Wang

On Tue, Aug 02, 2022 at 02:10:43PM +0200, Laurent Vivier wrote:
> On 02/08/2022 13:24, Eugenio Pérez wrote:
> > Few steps allocate new resources, and all of the allocated can be
> > checked to avoid trying to free an invalid one.
> > 
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>


qemu-trivial too I guess then?

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> > ---
> >   net/vhost-vdpa.c | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> > index 303447a68e..ac1810723c 100644
> > --- a/net/vhost-vdpa.c
> > +++ b/net/vhost-vdpa.c
> > @@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> >       queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
> >                                                    &has_cvq, errp);
> >       if (queue_pairs < 0) {
> > -        qemu_close(vdpa_device_fd);
> > -        return queue_pairs;
> > +        goto err;
> >       }
> >       if (opts->x_svq) {
> > @@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> >           if (invalid_dev_features) {
> >               error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
> >                          invalid_dev_features);
> > -            goto err_svq;
> > +            goto err;
> >           }
> >           vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
> > @@ -640,7 +639,6 @@ err:
> >           }
> >       }
> > -err_svq:
> >       qemu_close(vdpa_device_fd);
> >       return -1;
> 
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 12:57     ` Michael S. Tsirkin
@ 2022-08-02 12:58       ` Laurent Vivier
  2022-08-02 13:09         ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2022-08-02 12:58 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Eugenio Pérez, qemu-devel, Peter Maydell, qemu-trivial, Jason Wang

On 02/08/2022 14:57, Michael S. Tsirkin wrote:
> On Tue, Aug 02, 2022 at 02:10:43PM +0200, Laurent Vivier wrote:
>> On 02/08/2022 13:24, Eugenio Pérez wrote:
>>> Few steps allocate new resources, and all of the allocated can be
>>> checked to avoid trying to free an invalid one.
>>>
>>> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> 
> 
> qemu-trivial too I guess then?

For 7.1 or later?

Thanks,
Laurent

> 
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> 
>>> ---
>>>    net/vhost-vdpa.c | 6 ++----
>>>    1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
>>> index 303447a68e..ac1810723c 100644
>>> --- a/net/vhost-vdpa.c
>>> +++ b/net/vhost-vdpa.c
>>> @@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>>>        queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
>>>                                                     &has_cvq, errp);
>>>        if (queue_pairs < 0) {
>>> -        qemu_close(vdpa_device_fd);
>>> -        return queue_pairs;
>>> +        goto err;
>>>        }
>>>        if (opts->x_svq) {
>>> @@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
>>>            if (invalid_dev_features) {
>>>                error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
>>>                           invalid_dev_features);
>>> -            goto err_svq;
>>> +            goto err;
>>>            }
>>>            vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
>>> @@ -640,7 +639,6 @@ err:
>>>            }
>>>        }
>>> -err_svq:
>>>        qemu_close(vdpa_device_fd);
>>>        return -1;
>>
>> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 12:58       ` Laurent Vivier
@ 2022-08-02 13:09         ` Michael S. Tsirkin
  2022-08-02 13:16           ` Eugenio Perez Martin
  0 siblings, 1 reply; 10+ messages in thread
From: Michael S. Tsirkin @ 2022-08-02 13:09 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Eugenio Pérez, qemu-devel, Peter Maydell, qemu-trivial, Jason Wang

On Tue, Aug 02, 2022 at 02:58:36PM +0200, Laurent Vivier wrote:
> On 02/08/2022 14:57, Michael S. Tsirkin wrote:
> > On Tue, Aug 02, 2022 at 02:10:43PM +0200, Laurent Vivier wrote:
> > > On 02/08/2022 13:24, Eugenio Pérez wrote:
> > > > Few steps allocate new resources, and all of the allocated can be
> > > > checked to avoid trying to free an invalid one.
> > > > 
> > > > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > 
> > 
> > qemu-trivial too I guess then?
> 
> For 7.1 or later?
> 
> Thanks,
> Laurent

I don't really care. Since you are merging this you get to decide.

> > 
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > > > ---
> > > >    net/vhost-vdpa.c | 6 ++----
> > > >    1 file changed, 2 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> > > > index 303447a68e..ac1810723c 100644
> > > > --- a/net/vhost-vdpa.c
> > > > +++ b/net/vhost-vdpa.c
> > > > @@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> > > >        queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
> > > >                                                     &has_cvq, errp);
> > > >        if (queue_pairs < 0) {
> > > > -        qemu_close(vdpa_device_fd);
> > > > -        return queue_pairs;
> > > > +        goto err;
> > > >        }
> > > >        if (opts->x_svq) {
> > > > @@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> > > >            if (invalid_dev_features) {
> > > >                error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
> > > >                           invalid_dev_features);
> > > > -            goto err_svq;
> > > > +            goto err;
> > > >            }
> > > >            vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
> > > > @@ -640,7 +639,6 @@ err:
> > > >            }
> > > >        }
> > > > -err_svq:
> > > >        qemu_close(vdpa_device_fd);
> > > >        return -1;
> > > 
> > > Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> > 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto
  2022-08-02 13:09         ` Michael S. Tsirkin
@ 2022-08-02 13:16           ` Eugenio Perez Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Eugenio Perez Martin @ 2022-08-02 13:16 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Laurent Vivier, qemu-level, Peter Maydell, qemu-trivial, Jason Wang

On Tue, Aug 2, 2022 at 3:10 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Tue, Aug 02, 2022 at 02:58:36PM +0200, Laurent Vivier wrote:
> > On 02/08/2022 14:57, Michael S. Tsirkin wrote:
> > > On Tue, Aug 02, 2022 at 02:10:43PM +0200, Laurent Vivier wrote:
> > > > On 02/08/2022 13:24, Eugenio Pérez wrote:
> > > > > Few steps allocate new resources, and all of the allocated can be
> > > > > checked to avoid trying to free an invalid one.
> > > > >
> > > > > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > >
> > >
> > > qemu-trivial too I guess then?
> >
> > For 7.1 or later?
> >
> > Thanks,
> > Laurent
>
> I don't really care. Since you are merging this you get to decide.
>

In my opinion it's better to leave that for a later revision.

I sent it to trivial because it only touches a few lines of code and
it's easy to review even without knowledge of net or vdpa subsystem,
but if it's not appropriate I can send future patches like this out of
trivial.

Thanks!

> > >
> > > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > >
> > > > > ---
> > > > >    net/vhost-vdpa.c | 6 ++----
> > > > >    1 file changed, 2 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> > > > > index 303447a68e..ac1810723c 100644
> > > > > --- a/net/vhost-vdpa.c
> > > > > +++ b/net/vhost-vdpa.c
> > > > > @@ -588,8 +588,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> > > > >        queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features,
> > > > >                                                     &has_cvq, errp);
> > > > >        if (queue_pairs < 0) {
> > > > > -        qemu_close(vdpa_device_fd);
> > > > > -        return queue_pairs;
> > > > > +        goto err;
> > > > >        }
> > > > >        if (opts->x_svq) {
> > > > > @@ -604,7 +603,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
> > > > >            if (invalid_dev_features) {
> > > > >                error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
> > > > >                           invalid_dev_features);
> > > > > -            goto err_svq;
> > > > > +            goto err;
> > > > >            }
> > > > >            vhost_vdpa_get_iova_range(vdpa_device_fd, &iova_range);
> > > > > @@ -640,7 +639,6 @@ err:
> > > > >            }
> > > > >        }
> > > > > -err_svq:
> > > > >        qemu_close(vdpa_device_fd);
> > > > >        return -1;
> > > >
> > > > Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> > >
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-02 13:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 11:24 [PATCH 0/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
2022-08-02 11:24 ` [PATCH 1/2] vdpa: Fix file descriptor leak on get features error Eugenio Pérez
2022-08-02 12:07   ` Laurent Vivier
2022-08-02 12:56     ` Michael S. Tsirkin
2022-08-02 11:24 ` [PATCH 2/2] vdpa: Merge all net_init_vhost_vdpa error goto Eugenio Pérez
2022-08-02 12:10   ` Laurent Vivier
2022-08-02 12:57     ` Michael S. Tsirkin
2022-08-02 12:58       ` Laurent Vivier
2022-08-02 13:09         ` Michael S. Tsirkin
2022-08-02 13:16           ` Eugenio Perez Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.