pktgen: Fix memory leak in pktgen_if_write
Subsystems (2)
PATCH 1/1 pktgen: Fix memory leak in pktgen_if_write
_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 <[email protected]>
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- net/core/pktgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/pktgen.c +1 -1
@@ -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" )) {
Signature · 1 line
2.7.4
Quoted 5 lines · 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 <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
Acked-by Arnd Bergmann <[email protected]>
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.
From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 14 Mar 2018 03:07:27 -0500
Quoted 5 lines
_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 <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied, thanks.