diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-02-24 11:43:37 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-22 12:43:32 +0100 |
commit | 02595f472548738cd1ab3abf424277d6f489048f (patch) | |
tree | 724fd0fad172206ed68307aa4235a9960f785164 /drivers/net | |
parent | 0a40da4a74f1767c8ff7faffe86bcb06cae280ed (diff) |
geneve: lock RCU on TX path
[ Upstream commit a717e3f740803cc88bd5c9a70c93504f6a368663 ]
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/geneve.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 8b4822ad27cb..3c1f89ab0110 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -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 ip_tunnel_info *info = NULL; + int err; if (geneve->collect_md) info = skb_tunnel_info(skb); + rcu_read_lock(); #if IS_ENABLED(CONFIG_IPV6) if ((info && ip_tunnel_info_af(info) == 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 - 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) |