linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pktgen: Fix memory leak in pktgen_if_write
@ 2018-03-14  8:07 Gustavo A. R. Silva
  2018-03-14  8:40 ` Arnd Bergmann
  2018-03-14 14:02 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2018-03-14  8:07 UTC (permalink / raw)
  To: David S. Miller, Arnd Bergmann, Wang Jian
  Cc: netdev, linux-kernel, Gustavo A. R. Silva

_buf_ is an array and the one that must be freed is _tp_ instead.

Fixes: a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer")
Reported-by: Wang Jian <jianjian.wang1@gmail.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 net/core/pktgen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fd65761..545cf08 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -913,7 +913,7 @@ static ssize_t pktgen_if_write(struct file *file,
 			return PTR_ERR(tp);
 
 		pr_debug("%s,%zu  buffer -:%s:-\n", name, count, tp);
-		kfree(buf);
+		kfree(tp);
 	}
 
 	if (!strcmp(name, "min_pkt_size")) {
-- 
2.7.4

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

* Re: [PATCH] pktgen: Fix memory leak in pktgen_if_write
  2018-03-14  8:07 [PATCH] pktgen: Fix memory leak in pktgen_if_write Gustavo A. R. Silva
@ 2018-03-14  8:40 ` Arnd Bergmann
  2018-03-14 14:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-03-14  8:40 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: David S. Miller, Wang Jian, Networking, Linux Kernel Mailing List

On Wed, Mar 14, 2018 at 9:07 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> _buf_ is an array and the one that must be freed is _tp_ instead.
>
> Fixes: a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer")
> Reported-by: Wang Jian <jianjian.wang1@gmail.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Thanks for fixing up my mistake so quickly, and thanks to Wang for the report

I was about to send the same patch, but you got there first.

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

* Re: [PATCH] pktgen: Fix memory leak in pktgen_if_write
  2018-03-14  8:07 [PATCH] pktgen: Fix memory leak in pktgen_if_write Gustavo A. R. Silva
  2018-03-14  8:40 ` Arnd Bergmann
@ 2018-03-14 14:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-14 14:02 UTC (permalink / raw)
  To: gustavo; +Cc: arnd, jianjian.wang1, netdev, linux-kernel

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Wed, 14 Mar 2018 03:07:27 -0500

> _buf_ is an array and the one that must be freed is _tp_ instead.
> 
> Fixes: a870a02cc963 ("pktgen: use dynamic allocation for debug print buffer")
> Reported-by: Wang Jian <jianjian.wang1@gmail.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied, thanks.

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

end of thread, other threads:[~2018-03-14 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14  8:07 [PATCH] pktgen: Fix memory leak in pktgen_if_write Gustavo A. R. Silva
2018-03-14  8:40 ` Arnd Bergmann
2018-03-14 14:02 ` David Miller

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