Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49d0edfd authored by Hannes Frederic Sowa's avatar Hannes Frederic Sowa Committed by Sasha Levin
Browse files

fou: clean up socket with kfree_rcu



[ Upstream commit 3036facbb7be3a169e35be3b271162b0fa564a2d ]

fou->udp_offloads is managed by RCU. As it is actually included inside
the fou sockets, we cannot let the memory go out of scope before a grace
period. We either can synchronize_rcu or switch over to kfree_rcu to
manage the sockets. kfree_rcu seems appropriate as it is used by vxlan
and geneve.

Fixes: 23461551 ("fou: Support for foo-over-udp RX path")
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 56619856
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ struct fou {
	u16 port;
	struct udp_offload udp_offloads;
	struct list_head list;
	struct rcu_head rcu;
};

struct fou_cfg {
@@ -287,7 +288,7 @@ static void fou_release(struct fou *fou)

	sock_release(sock);

	kfree(fou);
	kfree_rcu(fou, rcu);
}

static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg)