All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: fix memory leak in spapr_core_pre_plug()
@ 2017-07-14  7:50 Greg Kurz
  2017-07-14  8:34 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2017-07-14  7:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, qemu-stable, David Gibson

In case of error, we must ensure the dynamically allocated base_core_type
is freed, like it is done everywhere else in this function.

This is a regression introduced in QEMU 2.9 by commit 8149e2992f78.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/ppc/spapr.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 638b8243de04..ed9b57d1fc2a 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3150,9 +3150,9 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
      * total vcpus not a multiple of threads-per-core.
      */
     if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) {
-        error_setg(errp, "invalid nr-threads %d, must be %d",
+        error_setg(&local_err, "invalid nr-threads %d, must be %d",
                    cc->nr_threads, smp_threads);
-        return;
+        goto out;
     }
 
     core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index);

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

* Re: [Qemu-devel] [PATCH] spapr: fix memory leak in spapr_core_pre_plug()
  2017-07-14  7:50 [Qemu-devel] [PATCH] spapr: fix memory leak in spapr_core_pre_plug() Greg Kurz
@ 2017-07-14  8:34 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-07-14  8:34 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-devel, qemu-ppc, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

On Fri, Jul 14, 2017 at 09:50:40AM +0200, Greg Kurz wrote:
> In case of error, we must ensure the dynamically allocated base_core_type
> is freed, like it is done everywhere else in this function.
> 
> This is a regression introduced in QEMU 2.9 by commit 8149e2992f78.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-2.10.

> ---
>  hw/ppc/spapr.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 638b8243de04..ed9b57d1fc2a 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3150,9 +3150,9 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
>       * total vcpus not a multiple of threads-per-core.
>       */
>      if (mc->has_hotpluggable_cpus && (cc->nr_threads != smp_threads)) {
> -        error_setg(errp, "invalid nr-threads %d, must be %d",
> +        error_setg(&local_err, "invalid nr-threads %d, must be %d",
>                     cc->nr_threads, smp_threads);
> -        return;
> +        goto out;
>      }
>  
>      core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index);
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-07-14 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14  7:50 [Qemu-devel] [PATCH] spapr: fix memory leak in spapr_core_pre_plug() Greg Kurz
2017-07-14  8:34 ` David Gibson

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.