From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Oskolkov Subject: [PATCH net] net/ipv6: do not copy DST_NOCOUNT flag on rt init Date: Thu, 13 Sep 2018 13:38:14 -0700 Message-ID: <20180913203814.189698-1-posk@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Peter Oskolkov , David Ahern To: David Miller , netdev@vger.kernel.org Return-path: Received: from mail-vk1-f201.google.com ([209.85.221.201]:41338 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbeINBuO (ORCPT ); Thu, 13 Sep 2018 21:50:14 -0400 Received: by mail-vk1-f201.google.com with SMTP id d189-v6so832607vka.8 for ; Thu, 13 Sep 2018 13:39:07 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: DST_NOCOUNT in dst_entry::flags tracks whether the entry counts toward route cache size (net->ipv6.sysctl.ip6_rt_max_size). If the flag is NOT set, dst_ops::pcpuc_entries counter is incremented in dist_init() and decremented in dst_destroy(). This flag is tied to allocation/deallocation of dst_entry and should not be copied from another dst/route. Otherwise it can happen that dst_ops::pcpuc_entries counter grows until no new routes can be allocated because the counter reached ip6_rt_max_size due to DST_NOCOUNT not set and thus no counter decrements on gc-ed routes. Fixes: 3b6761d18bc1 ("net/ipv6: Move dst flags to booleans in fib entries") Cc: David Ahern Acked-by: Wei Wang Signed-off-by: Peter Oskolkov --- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 3eed045c65a5..a3902f805305 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -946,7 +946,7 @@ static void ip6_rt_init_dst_reject(struct rt6_info *rt, struct fib6_info *ort) static void ip6_rt_init_dst(struct rt6_info *rt, struct fib6_info *ort) { - rt->dst.flags |= fib6_info_dst_flags(ort); + rt->dst.flags |= fib6_info_dst_flags(ort) & ~DST_NOCOUNT; if (ort->fib6_flags & RTF_REJECT) { ip6_rt_init_dst_reject(rt, ort); -- 2.19.0.397.gdd90340f6a-goog