All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hamradio: Resolve memory leak due to missing firmware release in add_mcs()
@ 2011-01-06 20:50 Jesper Juhl
  2011-01-09 23:46 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-01-06 20:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: netdev, linux-hams, Jean-Paul Roubelat, Frederic Rible, Thomas Sailer


Failure to release_firmware() in drivers/net/hamradio/yam.c::add_mcs() 
causes memory leak.
This patch should fix it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 yam.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

  compile tested only

diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 4e7d1d0..7d9ced0 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -396,7 +396,7 @@ static unsigned char *add_mcs(unsigned char *bits, int bitrate,
 	while (p) {
 		if (p->bitrate == bitrate) {
 			memcpy(p->bits, bits, YAM_FPGA_SIZE);
-			return p->bits;
+			goto out;
 		}
 		p = p->next;
 	}
@@ -411,7 +411,7 @@ static unsigned char *add_mcs(unsigned char *bits, int bitrate,
 	p->bitrate = bitrate;
 	p->next = yam_data;
 	yam_data = p;
-
+ out:
 	release_firmware(fw);
 	return p->bits;
 }


-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: [PATCH] hamradio: Resolve memory leak due to missing firmware release in add_mcs()
  2011-01-06 20:50 [PATCH] hamradio: Resolve memory leak due to missing firmware release in add_mcs() Jesper Juhl
@ 2011-01-09 23:46 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-09 23:46 UTC (permalink / raw)
  To: jj; +Cc: linux-kernel, netdev, linux-hams, jpr, frible, sailer

From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 6 Jan 2011 21:50:29 +0100 (CET)

> 
> Failure to release_firmware() in drivers/net/hamradio/yam.c::add_mcs() 
> causes memory leak.
> This patch should fix it.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied.

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

end of thread, other threads:[~2011-01-09 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-06 20:50 [PATCH] hamradio: Resolve memory leak due to missing firmware release in add_mcs() Jesper Juhl
2011-01-09 23:46 ` David Miller

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.