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)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:06:58 +0000 (13:06 +0000)
commit6243fbd56de4956a04ac6cf0f14a7a4d7b42896e
tree101d1d93510877531b09ab898bf34adadb14796b
parenta249ea47f518da6d63bbe95e61ea6792bc4de97b
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