Commit 02595f47 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Greg Kroah-Hartman

geneve: lock RCU on TX path

[ Upstream commit a717e3f7 ]

There is no guarantees that callers of the TX path will hold
the RCU lock.  Grab it explicitly.

Fixes: fceb9c3e ("geneve: avoid using stale geneve socket.")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0a40da4a
...@@ -1039,16 +1039,22 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1039,16 +1039,22 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct geneve_dev *geneve = netdev_priv(dev); struct geneve_dev *geneve = netdev_priv(dev);
struct ip_tunnel_info *info = NULL; struct ip_tunnel_info *info = NULL;
int err;
if (geneve->collect_md) if (geneve->collect_md)
info = skb_tunnel_info(skb); info = skb_tunnel_info(skb);
rcu_read_lock();
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if ((info && ip_tunnel_info_af(info) == AF_INET6) || if ((info && ip_tunnel_info_af(info) == AF_INET6) ||
(!info && geneve->remote.sa.sa_family == AF_INET6)) (!info && geneve->remote.sa.sa_family == AF_INET6))
return geneve6_xmit_skb(skb, dev, info); err = geneve6_xmit_skb(skb, dev, info);
else
#endif #endif
return geneve_xmit_skb(skb, dev, info); err = geneve_xmit_skb(skb, dev, info);
rcu_read_unlock();
return err;
} }
static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict) static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment