diff options
author | Jesse Gross <jesse@nicira.com> | 2014-12-16 18:25:31 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-27 08:29:32 -0800 |
commit | 4378fe7d7973624d7b9a8d814651c82e428c241b (patch) | |
tree | 14494bba7fbbe8c7bfc3fbfedd8aba1183c78f5f /net | |
parent | 3c030f1946d3faf374d71824de18bf1f201e416c (diff) |
geneve: Remove socket and offload handlers at destruction.
[ Upstream commit 7ed767f73192d6daf673c6d885cd02d5f280ac1f ]
Sockets aren't currently removed from the the global list when
they are destroyed. In addition, offload handlers need to be cleaned
up as well.
Fixes: 0b5e8b8e ("net: Add Geneve tunneling protocol driver")
CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/geneve.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c index dedb21e99914..3282c911e83c 100644 --- a/net/ipv4/geneve.c +++ b/net/ipv4/geneve.c @@ -165,6 +165,15 @@ static void geneve_notify_add_rx_port(struct geneve_sock *gs) } } +static void geneve_notify_del_rx_port(struct geneve_sock *gs) +{ + struct sock *sk = gs->sock->sk; + sa_family_t sa_family = sk->sk_family; + + if (sa_family == AF_INET) + udp_del_offload(&gs->udp_offloads); +} + /* Callback from net/ipv4/udp.c to receive packets */ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { @@ -318,9 +327,17 @@ EXPORT_SYMBOL_GPL(geneve_sock_add); void geneve_sock_release(struct geneve_sock *gs) { + struct net *net = sock_net(gs->sock->sk); + struct geneve_net *gn = net_generic(net, geneve_net_id); + if (!atomic_dec_and_test(&gs->refcnt)) return; + spin_lock(&gn->sock_lock); + hlist_del_rcu(&gs->hlist); + geneve_notify_del_rx_port(gs); + spin_unlock(&gn->sock_lock); + queue_work(geneve_wq, &gs->del_work); } EXPORT_SYMBOL_GPL(geneve_sock_release); |