linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: fix memory leaks in QE library
@ 2008-08-18 21:12 Timur Tabi
  2008-08-20  6:38 ` Tony Breeds
  2008-08-21  4:24 ` Kumar Gala
  0 siblings, 2 replies; 4+ messages in thread
From: Timur Tabi @ 2008-08-18 21:12 UTC (permalink / raw)
  To: galak, linuxppc-dev, avorontsov, benh, tony

Fix two memory leaks in the Freescale QE library: add a missing kfree() in
ucc_fast_init() if the ioremap() fails, and update ucc_fast_free() to call
iounmap() on uf_regs.

Based on a patch from Tony Breeds <tony@bakeyournoodle.com>.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index 1aecb07..25fbbfa 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -208,6 +208,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
 	uccf->uf_regs = ioremap(uf_info->regs, sizeof(struct ucc_fast));
 	if (uccf->uf_regs == NULL) {
 		printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__);
+		kfree(uccf);
 		return -ENOMEM;
 	}
 
@@ -355,6 +356,9 @@ void ucc_fast_free(struct ucc_fast_private * uccf)
 	if (uccf->ucc_fast_rx_virtual_fifo_base_offset)
 		qe_muram_free(uccf->ucc_fast_rx_virtual_fifo_base_offset);
 
+	if (uccf->uf_regs)
+		iounmap(uccf->uf_regs);
+
 	kfree(uccf);
 }
 EXPORT_SYMBOL(ucc_fast_free);
-- 
1.5.5

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

* Re: [PATCH] powerpc: fix memory leaks in QE library
  2008-08-18 21:12 [PATCH] powerpc: fix memory leaks in QE library Timur Tabi
@ 2008-08-20  6:38 ` Tony Breeds
  2008-08-20 11:28   ` Timur Tabi
  2008-08-21  4:24 ` Kumar Gala
  1 sibling, 1 reply; 4+ messages in thread
From: Tony Breeds @ 2008-08-20  6:38 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev

On Mon, Aug 18, 2008 at 04:12:08PM -0500, Timur Tabi wrote:
> Fix two memory leaks in the Freescale QE library: add a missing kfree() in
> ucc_fast_init() if the ioremap() fails, and update ucc_fast_free() to call
> iounmap() on uf_regs.

It's been pointed out in
http://bugzilla.kernel.org/show_bug.cgi?id=11371
that ucc_slow suffers from the same (welll clsoe enough) 2 problems.
Care to fix them aswell?

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!

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

* Re: [PATCH] powerpc: fix memory leaks in QE library
  2008-08-20  6:38 ` Tony Breeds
@ 2008-08-20 11:28   ` Timur Tabi
  0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2008-08-20 11:28 UTC (permalink / raw)
  To: Tony Breeds; +Cc: linuxppc-dev

On Wed, Aug 20, 2008 at 1:38 AM, Tony Breeds <tony@bakeyournoodle.com> wrote:

> It's been pointed out in
> http://bugzilla.kernel.org/show_bug.cgi?id=11371
> that ucc_slow suffers from the same (welll clsoe enough) 2 problems.
> Care to fix them aswell?

Sure.  I'll do a sweep o the QE code just to make sure there aren't even more.

Of course, it would have been nice if someone had looked up the
maintainer of the QE library in the MAINTAINERS file and notified me
about these bugs.

-- 
Timur Tabi
Linux kernel developer at Freescale

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

* Re: [PATCH] powerpc: fix memory leaks in QE library
  2008-08-18 21:12 [PATCH] powerpc: fix memory leaks in QE library Timur Tabi
  2008-08-20  6:38 ` Tony Breeds
@ 2008-08-21  4:24 ` Kumar Gala
  1 sibling, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-08-21  4:24 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev


On Aug 18, 2008, at 4:12 PM, Timur Tabi wrote:

> Fix two memory leaks in the Freescale QE library: add a missing  
> kfree() in
> ucc_fast_init() if the ioremap() fails, and update ucc_fast_free()  
> to call
> iounmap() on uf_regs.
>
> Based on a patch from Tony Breeds <tony@bakeyournoodle.com>.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/sysdev/qe_lib/ucc_fast.c |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)

applied.

- k

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

end of thread, other threads:[~2008-08-21  4:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-18 21:12 [PATCH] powerpc: fix memory leaks in QE library Timur Tabi
2008-08-20  6:38 ` Tony Breeds
2008-08-20 11:28   ` Timur Tabi
2008-08-21  4:24 ` Kumar Gala

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).