diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2015-12-15 15:01:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-16 19:03:02 -0500 |
commit | 3036facbb7be3a169e35be3b271162b0fa564a2d (patch) | |
tree | ff2025b940b458bed6abce9963f980710f3ef93c /net/ipv4 | |
parent | 4d4f37910b8a120e9cf5a436256db84295437ac7 (diff) |
fou: clean up socket with kfree_rcu
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>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fou.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index e0fcbbbcfe54..bd903fe0f750 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -24,6 +24,7 @@ struct fou { | |||
24 | u16 type; | 24 | u16 type; |
25 | struct udp_offload udp_offloads; | 25 | struct udp_offload udp_offloads; |
26 | struct list_head list; | 26 | struct list_head list; |
27 | struct rcu_head rcu; | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) | 30 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) |
@@ -417,7 +418,7 @@ static void fou_release(struct fou *fou) | |||
417 | list_del(&fou->list); | 418 | list_del(&fou->list); |
418 | udp_tunnel_sock_release(sock); | 419 | udp_tunnel_sock_release(sock); |
419 | 420 | ||
420 | kfree(fou); | 421 | kfree_rcu(fou, rcu); |
421 | } | 422 | } |
422 | 423 | ||
423 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) | 424 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) |