Skip to content

Commit

Permalink
pktgen: Fix memory leak in pktgen_if_write
Browse files Browse the repository at this point in the history
_buf_ is an array and the one that must be freed is _tp_ instead.

Fixes: a870a02 ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Gustavo A. R. Silva authored and David S. Miller committed Mar 14, 2018
1 parent a870a02 commit 29d1df7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit 29d1df7

Please sign in to comment.