]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerJiri Slaby <jslaby@suse.cz>
Thu, 12 Mar 2015 09:06:23 +0000 (10:06 +0100)
commit85320d5deb74d8cdb05082a84ef8d13812c0ea9f
tree65847a476b32e4a634564a45178e62822570df7b
parent4e522af0f15f3c2f63b789c0a6e6008eeb8f42b3
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: Jiri Slaby <jslaby@suse.cz>
net/core/gen_stats.c