All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath6kl: fix memory leak in ath6kl_fwlog_block_read()
@ 2012-04-11 20:41 Jesper Juhl
  2012-04-16  6:07   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2012-04-11 20:41 UTC (permalink / raw)
  To: linux-wireless
  Cc: netdev, linux-kernel, Robert Love, John W. Linville, Kalle Valo

If, in
drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(),
the call to wait_for_completion_interruptible() returns -ERESTARTSYS
then we'll return without freeing the (as yet unused) memory we
allocated for 'buf' - thus leaking it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wireless/ath/ath6kl/debug.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index d01403a..34eb927 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -401,8 +401,10 @@ static ssize_t ath6kl_fwlog_block_read(struct file *file,
 
 		ret = wait_for_completion_interruptible(
 			&ar->debug.fwlog_completion);
-		if (ret == -ERESTARTSYS)
+		if (ret == -ERESTARTSYS) {
+			vfree(buf);
 			return ret;
+		}
 
 		spin_lock(&ar->debug.fwlog_queue.lock);
 	}
-- 
1.7.10


PS. Please CC me on replies.

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


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

* Re: [PATCH] ath6kl: fix memory leak in ath6kl_fwlog_block_read()
@ 2012-04-16  6:07   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2012-04-16  6:07 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-wireless, netdev, linux-kernel, Robert Love,
	John W. Linville, ath6kl-devel

On 04/11/2012 11:41 PM, Jesper Juhl wrote:
> If, in
> drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(),
> the call to wait_for_completion_interruptible() returns -ERESTARTSYS
> then we'll return without freeing the (as yet unused) memory we
> allocated for 'buf' - thus leaking it.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Thanks, applied to ath6kl.git.

Kalle

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

* Re: [PATCH] ath6kl: fix memory leak in ath6kl_fwlog_block_read()
@ 2012-04-16  6:07   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2012-04-16  6:07 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Robert Love,
	John W. Linville, ath6kl-devel

On 04/11/2012 11:41 PM, Jesper Juhl wrote:
> If, in
> drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(),
> the call to wait_for_completion_interruptible() returns -ERESTARTSYS
> then we'll return without freeing the (as yet unused) memory we
> allocated for 'buf' - thus leaking it.
> 
> Signed-off-by: Jesper Juhl <jj-IYz4IdjRLj0sV2N9l4h3zg@public.gmane.org>

Thanks, applied to ath6kl.git.

Kalle
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-04-16  6:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 20:41 [PATCH] ath6kl: fix memory leak in ath6kl_fwlog_block_read() Jesper Juhl
2012-04-16  6:07 ` Kalle Valo
2012-04-16  6:07   ` Kalle Valo

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.