]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fou: clean up socket with kfree_rcu
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Tue, 15 Dec 2015 20:01:53 +0000 (21:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Dec 2015 00:03:02 +0000 (19:03 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fou.c

index e0fcbbbcfe54d0b35b46597b5f217075ffbc745c..bd903fe0f7508d9d7a94c4ce1e0a825f3e35c398 100644 (file)
@@ -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)