1 From 17c33753f9b68288a2e8551b6161ca54f1809d37 Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Sun, 15 Dec 2019 22:08:04 +0100
4 Subject: [PATCH 078/124] wireguard: allowedips: use kfree_rcu() instead of
7 commit d89ee7d5c73af15c1c6f12b016cdf469742b5726 upstream.
9 The callback function of call_rcu() just calls a kfree(), so we
10 can use kfree_rcu() instead of call_rcu() + callback function.
12 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
13 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
17 drivers/net/wireguard/allowedips.c | 7 +------
18 1 file changed, 1 insertion(+), 6 deletions(-)
20 --- a/drivers/net/wireguard/allowedips.c
21 +++ b/drivers/net/wireguard/allowedips.c
22 @@ -31,11 +31,6 @@ static void copy_and_assign_cidr(struct
23 #define CHOOSE_NODE(parent, key) \
24 parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1]
26 -static void node_free_rcu(struct rcu_head *rcu)
28 - kfree(container_of(rcu, struct allowedips_node, rcu));
31 static void push_rcu(struct allowedips_node **stack,
32 struct allowedips_node __rcu *p, unsigned int *len)
34 @@ -112,7 +107,7 @@ static void walk_remove_by_peer(struct a
35 if (!node->bit[0] || !node->bit[1]) {
36 rcu_assign_pointer(*nptr, DEREF(
37 &node->bit[!REF(node->bit[0])]));
38 - call_rcu(&node->rcu, node_free_rcu);
39 + kfree_rcu(node, rcu);