netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] fou: clean up socket with kfree_rcu
@ 2015-12-15 20:01 Hannes Frederic Sowa
  2015-12-15 20:01 ` [PATCH net 2/2] udp: restrict offloads to one namespace Hannes Frederic Sowa
  2015-12-17  0:03 ` [PATCH net 1/2] fou: clean up socket with kfree_rcu David Miller
  0 siblings, 2 replies; 14+ messages in thread
From: Hannes Frederic Sowa @ 2015-12-15 20:01 UTC (permalink / raw)
  To: netdev; +Cc: Tom Herbert

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: 23461551c00628c ("fou: Support for foo-over-udp RX path")
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
 net/ipv4/fou.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index e0fcbbbcfe54d0..bd903fe0f7508d 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -24,6 +24,7 @@ struct fou {
 	u16 type;
 	struct udp_offload udp_offloads;
 	struct list_head list;
+	struct rcu_head rcu;
 };
 
 #define FOU_F_REMCSUM_NOPARTIAL BIT(0)
@@ -417,7 +418,7 @@ static void fou_release(struct fou *fou)
 	list_del(&fou->list);
 	udp_tunnel_sock_release(sock);
 
-	kfree(fou);
+	kfree_rcu(fou, rcu);
 }
 
 static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg)
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-12-17 21:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 20:01 [PATCH net 1/2] fou: clean up socket with kfree_rcu Hannes Frederic Sowa
2015-12-15 20:01 ` [PATCH net 2/2] udp: restrict offloads to one namespace Hannes Frederic Sowa
2015-12-15 20:26   ` Tom Herbert
2015-12-15 20:46     ` Hannes Frederic Sowa
2015-12-15 22:39       ` Tom Herbert
2015-12-16 16:43         ` Hannes Frederic Sowa
2015-12-17  0:04   ` David Miller
2015-12-17  8:49     ` Hannes Frederic Sowa
2015-12-17 17:32       ` Tom Herbert
2015-12-17 17:40         ` Hannes Frederic Sowa
2015-12-17 18:10           ` Tom Herbert
2015-12-17 20:33             ` Hannes Frederic Sowa
2015-12-17 21:31               ` Tom Herbert
2015-12-17  0:03 ` [PATCH net 1/2] fou: clean up socket with kfree_rcu David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).