OSDN Git Service

net: replace dst_cache ip6_tunnel implementation with the generic one
authorPaolo Abeni <pabeni@redhat.com>
Fri, 12 Feb 2016 14:43:54 +0000 (15:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:03:34 +0000 (11:03 +0100)
commitb8c7f80cbdcd99b24f25edd5505fde90759ce07c
tree0cdb03f72b00a7b7b906c78097c73dadc2e34a23
parentd365b297433cf2969fa94f243d7afddc073c7bf1
net: replace dst_cache ip6_tunnel implementation with the generic one

commit 607f725f6f7d5ec3759fbc16224afb60e2152a5b upstream.

This also fix a potential race into the existing tunnel code, which
could lead to the wrong dst to be permanenty cached:

CPU1: CPU2:
  <xmit on ip6_tunnel>
  <cache lookup fails>
  dst = ip6_route_output(...)
<tunnel params are changed via nl>
dst_cache_reset() // no effect,
// the cache is empty
  dst_cache_set() // the wrong dst
// is permanenty stored
// into the cache

With the new dst implementation the above race is not possible
since the first cache lookup after dst_cache_reset will fail due
to the timestamp check

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Suggested-and-acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Manoj Boopathi Raj <manojboopathi@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/ip6_tunnel.h
net/ipv6/Kconfig
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c