gen_stats.c: Duplicate xstats buffer for later use
authorIgnacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Fri, 13 Feb 2015 22:47:05 +0000 (14:47 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2015 12:22:26 +0000 (13:22 +0100)
commit54c7f8978bfe00fdc80e44a0451a1f8f8b8de638
treebf80cdbf31c18e47912b9623e92a20f1220d7ba4
parent140b057ced8f43b93c4d934eb94661782155f683
gen_stats.c: Duplicate xstats buffer for later use

[ Upstream commit 1c4cff0cf55011792125b6041bc4e9713e46240f ]

The gnet_stats_copy_app() function gets called, more often than not, with its
second argument a pointer to an automatic variable in the caller's stack.
Therefore, to avoid copying garbage afterwards when calling
gnet_stats_finish_copy(), this data is better copied to a dynamically allocated
memory that gets freed after use.

[xiyou.wangcong@gmail.com: remove a useless kfree()]

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/gen_stats.c