Skip to content

Commit

Permalink
fou: clean up socket with kfree_rcu
Browse files Browse the repository at this point in the history
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: 2346155 ("fou: Support for foo-over-udp RX path")
Cc: Tom Herbert <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
strssndktn authored and davem330 committed Dec 17, 2015
1 parent 4d4f379 commit 3036fac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/fou.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3036fac

Please sign in to comment.