[PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()

Pan Nengyuan posted 12 patches 5 years, 6 months ago
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Max Reitz <mreitz@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Pierre Morel <pmorel@linux.ibm.com>, Eduardo Habkost <ehabkost@redhat.com>, Hailiang Zhang <zhang.zhanghailiang@huawei.com>, Thomas Huth <thuth@redhat.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Kevin Wolf <kwolf@redhat.com>, Viktor Prutyanov <viktor.prutyanov@phystech.edu>, Markus Armbruster <armbru@redhat.com>, Richard Henderson <rth@twiddle.net>, Alex Williamson <alex.williamson@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Juan Quintela <quintela@redhat.com>
There is a newer version of this series
[PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Pan Nengyuan 5 years, 6 months ago
Missing g_error_free() in vfio_ap_get_group() error path. Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Pierre Morel <pmorel@linux.ibm.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-s390x@nongnu.org
---
 hw/vfio/ap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index b9330a8e6f..cec6fe1599 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -71,6 +71,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
     if (!group_path) {
         error_setg(errp, "%s: no iommu_group found for %s: %s",
                    VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
+        g_error_free(gerror);
         return NULL;
     }
 
-- 
2.18.2


Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Pierre Morel 5 years, 6 months ago

On 2020-08-14 18:02, Pan Nengyuan wrote:
> Missing g_error_free() in vfio_ap_get_group() error path. Fix that.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Pierre Morel <pmorel@linux.ibm.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: qemu-s390x@nongnu.org
> ---
>   hw/vfio/ap.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index b9330a8e6f..cec6fe1599 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -71,6 +71,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
>       if (!group_path) {
>           error_setg(errp, "%s: no iommu_group found for %s: %s",
>                      VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
> +        g_error_free(gerror);
>           return NULL;
>       }
>   
> 

Thanks Pan,

Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>


-- 
Pierre Morel
IBM Lab Boeblingen

Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Cornelia Huck 5 years, 5 months ago
On Fri, 14 Aug 2020 12:02:31 -0400
Pan Nengyuan <pannengyuan@huawei.com> wrote:

> Missing g_error_free() in vfio_ap_get_group() error path. Fix that.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Pierre Morel <pmorel@linux.ibm.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: qemu-s390x@nongnu.org
> ---
>  hw/vfio/ap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index b9330a8e6f..cec6fe1599 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -71,6 +71,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
>      if (!group_path) {
>          error_setg(errp, "%s: no iommu_group found for %s: %s",
>                     VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
> +        g_error_free(gerror);
>          return NULL;
>      }
>  

Thanks, applied.


Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Li Qiang 5 years, 5 months ago
Pan Nengyuan <pannengyuan@huawei.com> 于2020年8月14日周五 下午6:29写道:
>
> Missing g_error_free() in vfio_ap_get_group() error path. Fix that.
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

I see Cornelia Huck has merged this in his tree.
Don't know whether this series will go separate maintainer's tree or
as go only one maintainer's tree(maybe Paolo's misc tree?).


Thanks,
Li Qiang

> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: Tony Krowiak <akrowiak@linux.ibm.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Pierre Morel <pmorel@linux.ibm.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: qemu-s390x@nongnu.org
> ---
>  hw/vfio/ap.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
> index b9330a8e6f..cec6fe1599 100644
> --- a/hw/vfio/ap.c
> +++ b/hw/vfio/ap.c
> @@ -71,6 +71,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
>      if (!group_path) {
>          error_setg(errp, "%s: no iommu_group found for %s: %s",
>                     VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
> +        g_error_free(gerror);
>          return NULL;
>      }
>
> --
> 2.18.2
>
>

Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Cornelia Huck 5 years, 5 months ago
On Wed, 26 Aug 2020 19:03:37 +0800
Li Qiang <liq3ea@gmail.com> wrote:

> Pan Nengyuan <pannengyuan@huawei.com> 于2020年8月14日周五 下午6:29写道:
> >
> > Missing g_error_free() in vfio_ap_get_group() error path. Fix that.
> >
> > Reported-by: Euler Robot <euler.robot@huawei.com>
> > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>  
> 
> Reviewed-by: Li Qiang <liq3ea@gmail.com>
> 
> I see Cornelia Huck has merged this in his tree.

s/his/her/ :)

> Don't know whether this series will go separate maintainer's tree or
> as go only one maintainer's tree(maybe Paolo's misc tree?).

Whatever works best, but I still plan to send a pull req this week to
flush out my queue.


Re: [PATCH 02/12] hw/vfio/ap: Plug memleak in vfio_ap_get_group()
Posted by Li Qiang 5 years, 5 months ago
Cornelia Huck <cohuck@redhat.com> 于2020年8月26日周三 下午7:41写道:
>
> On Wed, 26 Aug 2020 19:03:37 +0800
> Li Qiang <liq3ea@gmail.com> wrote:
>
> > Pan Nengyuan <pannengyuan@huawei.com> 于2020年8月14日周五 下午6:29写道:
> > >
> > > Missing g_error_free() in vfio_ap_get_group() error path. Fix that.
> > >
> > > Reported-by: Euler Robot <euler.robot@huawei.com>
> > > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> >
> > Reviewed-by: Li Qiang <liq3ea@gmail.com>
> >
> > I see Cornelia Huck has merged this in his tree.
>
> s/his/her/ :)

I'm so sorry for this mistake.

Thanks,
Li Qiang

>
> > Don't know whether this series will go separate maintainer's tree or
> > as go only one maintainer's tree(maybe Paolo's misc tree?).
>
> Whatever works best, but I still plan to send a pull req this week to
> flush out my queue.



>