1 From foo@baz Wed Sep 26 11:27:32 CEST 2018
2 From: Peter Oskolkov <posk@google.com>
3 Date: Mon, 17 Sep 2018 10:20:53 -0700
4 Subject: net/ipv6: do not copy dst flags on rt init
6 From: Peter Oskolkov <posk@google.com>
8 [ Upstream commit 30bfd93062814d6767e452a8f5ddcd97f7e38c7e ]
10 DST_NOCOUNT in dst_entry::flags tracks whether the entry counts
11 toward route cache size (net->ipv6.sysctl.ip6_rt_max_size).
13 If the flag is NOT set, dst_ops::pcpuc_entries counter is incremented
14 in dist_init() and decremented in dst_destroy().
16 This flag is tied to allocation/deallocation of dst_entry and
17 should not be copied from another dst/route. Otherwise it can happen
18 that dst_ops::pcpuc_entries counter grows until no new routes can
19 be allocated because the counter reached ip6_rt_max_size due to
20 DST_NOCOUNT not set and thus no counter decrements on gc-ed routes.
22 Fixes: 3b6761d18bc1 ("net/ipv6: Move dst flags to booleans in fib entries")
23 Cc: David Ahern <dsahern@gmail.com>
24 Acked-by: Wei Wang <weiwan@google.com>
25 Signed-off-by: Peter Oskolkov <posk@google.com>
26 Reviewed-by: David Ahern <dsahern@gmail.com>
27 Signed-off-by: David S. Miller <davem@davemloft.net>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 net/ipv6/route.c | 2 --
31 1 file changed, 2 deletions(-)
33 --- a/net/ipv6/route.c
34 +++ b/net/ipv6/route.c
35 @@ -946,8 +946,6 @@ static void ip6_rt_init_dst_reject(struc
37 static void ip6_rt_init_dst(struct rt6_info *rt, struct fib6_info *ort)
39 - rt->dst.flags |= fib6_info_dst_flags(ort);
41 if (ort->fib6_flags & RTF_REJECT) {
42 ip6_rt_init_dst_reject(rt, ort);