* [PATCH net 0/2] VXLAN/geneve RCU fixes
@ 2017-02-24 19:43 Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 1/2] vxlan: lock RCU on TX path Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2017-02-24 19:43 UTC (permalink / raw)
To: netdev
Cc: oss-drivers, kubakici, Cong Wang, Pravin Shelar, Jiri Benc,
John W . Linville, Jakub Kicinski
Hi!
VXLAN and GENEVE need to take RCU lock explicitly because TX path
only has the _bh() flavour of RCU locked. Making the reconfiguration
path wait for both normal and _bh() RCU would be bigger hassle so
just acquire the lock, as suggested by Pravin:
https://www.mail-archive.com/netdev@vger.kernel.org/msg155583.html
Jakub Kicinski (2):
vxlan: lock RCU on TX path
geneve: lock RCU on TX path
drivers/net/geneve.c | 2 ++
drivers/net/vxlan.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] vxlan: lock RCU on TX path
2017-02-24 19:43 [PATCH net 0/2] VXLAN/geneve RCU fixes Jakub Kicinski
@ 2017-02-24 19:43 ` Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 2/2] geneve: " Jakub Kicinski
2017-03-01 17:59 ` [PATCH net 0/2] VXLAN/geneve RCU fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2017-02-24 19:43 UTC (permalink / raw)
To: netdev
Cc: oss-drivers, kubakici, Cong Wang, Pravin Shelar, Jiri Benc,
John W . Linville, Jakub Kicinski
There is no guarantees that callers of the TX path will hold
the RCU lock. Grab it explicitly.
Fixes: c6fcc4fc5f8b ("vxlan: avoid using stale vxlan socket.")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
drivers/net/vxlan.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 4e27c5b09600..e53ee696c962 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2108,6 +2108,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
src_port = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
vxlan->cfg.port_max, true);
+ rcu_read_lock();
if (dst->sa.sa_family == AF_INET) {
struct vxlan_sock *sock4 = rcu_dereference(vxlan->vn4_sock);
struct rtable *rt;
@@ -2130,7 +2131,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
dst_port, vni, &rt->dst,
rt->rt_flags);
if (err)
- return;
+ goto out_unlock;
} else if (info->key.tun_flags & TUNNEL_DONT_FRAGMENT) {
df = htons(IP_DF);
}
@@ -2169,7 +2170,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
dst_port, vni, ndst,
rt6i_flags);
if (err)
- return;
+ goto out_unlock;
}
tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
@@ -2186,6 +2187,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
label, src_port, dst_port, !udp_sum);
#endif
}
+out_unlock:
+ rcu_read_unlock();
return;
drop:
@@ -2194,6 +2197,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
return;
tx_error:
+ rcu_read_unlock();
if (err == -ELOOP)
dev->stats.collisions++;
else if (err == -ENETUNREACH)
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] geneve: lock RCU on TX path
2017-02-24 19:43 [PATCH net 0/2] VXLAN/geneve RCU fixes Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 1/2] vxlan: lock RCU on TX path Jakub Kicinski
@ 2017-02-24 19:43 ` Jakub Kicinski
2017-03-01 17:59 ` [PATCH net 0/2] VXLAN/geneve RCU fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2017-02-24 19:43 UTC (permalink / raw)
To: netdev
Cc: oss-drivers, kubakici, Cong Wang, Pravin Shelar, Jiri Benc,
John W . Linville, Jakub Kicinski
There is no guarantees that callers of the TX path will hold
the RCU lock. Grab it explicitly.
Fixes: fceb9c3e3825 ("geneve: avoid using stale geneve socket.")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
drivers/net/geneve.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 45301cb98bc1..7074b40ebd7f 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -881,12 +881,14 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
info = &geneve->info;
}
+ rcu_read_lock();
#if IS_ENABLED(CONFIG_IPV6)
if (info->mode & IP_TUNNEL_INFO_IPV6)
err = geneve6_xmit_skb(skb, dev, geneve, info);
else
#endif
err = geneve_xmit_skb(skb, dev, geneve, info);
+ rcu_read_unlock();
if (likely(!err))
return NETDEV_TX_OK;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] VXLAN/geneve RCU fixes
2017-02-24 19:43 [PATCH net 0/2] VXLAN/geneve RCU fixes Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 1/2] vxlan: lock RCU on TX path Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 2/2] geneve: " Jakub Kicinski
@ 2017-03-01 17:59 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-03-01 17:59 UTC (permalink / raw)
To: jakub.kicinski
Cc: netdev, oss-drivers, kubakici, xiyou.wangcong, pshelar, jbenc, linville
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri, 24 Feb 2017 11:43:35 -0800
> VXLAN and GENEVE need to take RCU lock explicitly because TX path
> only has the _bh() flavour of RCU locked. Making the reconfiguration
> path wait for both normal and _bh() RCU would be bigger hassle so
> just acquire the lock, as suggested by Pravin:
>
> https://www.mail-archive.com/netdev@vger.kernel.org/msg155583.html
Series applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-01 17:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 19:43 [PATCH net 0/2] VXLAN/geneve RCU fixes Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 1/2] vxlan: lock RCU on TX path Jakub Kicinski
2017-02-24 19:43 ` [PATCH net 2/2] geneve: " Jakub Kicinski
2017-03-01 17:59 ` [PATCH net 0/2] VXLAN/geneve RCU fixes 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).