linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: fix memory leak in queue_hotplug_event() error path
@ 2016-09-19  6:41 Andrew Donnellan
  2016-09-19 15:34 ` Nathan Fontenot
  2016-09-20 13:07 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Donnellan @ 2016-09-19  6:41 UTC (permalink / raw)
  To: linuxppc-dev

If we fail to allocate work, we don't end up using hp_errlog_copy. Free it
in the error path.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

---

Found by Coverity Scan. Compile tested only.
---
 arch/powerpc/platforms/pseries/dlpar.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 4748124..6a99e72 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -413,6 +413,7 @@ void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog,
 		queue_work(pseries_hp_wq, (struct work_struct *)work);
 	} else {
 		*rc = -ENOMEM;
+		kfree(hp_errlog_copy);
 		complete(hotplug_done);
 	}
 }
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

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

* Re: [PATCH] powerpc/pseries: fix memory leak in queue_hotplug_event() error path
  2016-09-19  6:41 [PATCH] powerpc/pseries: fix memory leak in queue_hotplug_event() error path Andrew Donnellan
@ 2016-09-19 15:34 ` Nathan Fontenot
  2016-09-20 13:07 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Fontenot @ 2016-09-19 15:34 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev

On 09/19/2016 01:41 AM, Andrew Donnellan wrote:
> If we fail to allocate work, we don't end up using hp_errlog_copy. Free it
> in the error path.
> 
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> 
> ---
> 
> Found by Coverity Scan. Compile tested only.
> ---
>  arch/powerpc/platforms/pseries/dlpar.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index 4748124..6a99e72 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -413,6 +413,7 @@ void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog,
>  		queue_work(pseries_hp_wq, (struct work_struct *)work);
>  	} else {
>  		*rc = -ENOMEM;
> +		kfree(hp_errlog_copy);
>  		complete(hotplug_done);
>  	}
>  }
> 

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

* Re: powerpc/pseries: fix memory leak in queue_hotplug_event() error path
  2016-09-19  6:41 [PATCH] powerpc/pseries: fix memory leak in queue_hotplug_event() error path Andrew Donnellan
  2016-09-19 15:34 ` Nathan Fontenot
@ 2016-09-20 13:07 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-09-20 13:07 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev

On Mon, 2016-19-09 at 06:41:32 UTC, Andrew Donnellan wrote:
> If we fail to allocate work, we don't end up using hp_errlog_copy. Free it
> in the error path.
> 
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/90ce35145cb622b3cd0007d50e

cheers

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

end of thread, other threads:[~2016-09-20 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19  6:41 [PATCH] powerpc/pseries: fix memory leak in queue_hotplug_event() error path Andrew Donnellan
2016-09-19 15:34 ` Nathan Fontenot
2016-09-20 13:07 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).