From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752658AbbJLQKd (ORCPT ); Mon, 12 Oct 2015 12:10:33 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:60627 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896AbbJLQK2 (ORCPT ); Mon, 12 Oct 2015 12:10:28 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: David Miller Cc: Dmitry Vyukov , Martin KaFai Lau , kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, Patrick McHardy , netdev@vger.kernel.org, LKML , syzkaller@googlegroups.com, Kostya Serebryany , Alexander Potapenko , Andrey Konovalov , Sasha Levin , Eric Dumazet , Maciej =?utf-8?Q?=C5=BBenczykowski?= , Eric Dumazet References: <1444652652.27760.158.camel@edumazet-glaptop2.roam.corp.google.com> Date: Mon, 12 Oct 2015 11:02:08 -0500 In-Reply-To: <1444652652.27760.158.camel@edumazet-glaptop2.roam.corp.google.com> (Eric Dumazet's message of "Mon, 12 Oct 2015 05:24:12 -0700") Message-ID: <87wpusoz27.fsf_-_@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX18WjQDg2jDiOAlBEEyCyVw/mtSXRo/LEc8= X-SA-Exim-Connect-IP: 67.3.201.231 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.0 XMGappySubj_02 Gappier still * 0.5 XMGappySubj_01 Very gappy subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4847] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;David Miller X-Spam-Relay-Country: X-Spam-Timing: total 519 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.6 (0.7%), b_tie_ro: 2.7 (0.5%), parse: 0.76 (0.1%), extract_message_metadata: 11 (2.2%), get_uri_detail_list: 1.40 (0.3%), tests_pri_-1000: 6 (1.1%), tests_pri_-950: 1.21 (0.2%), tests_pri_-900: 1.05 (0.2%), tests_pri_-400: 22 (4.3%), check_bayes: 21 (4.1%), b_tokenize: 7 (1.3%), b_tok_get_all: 7 (1.4%), b_comp_prob: 1.82 (0.4%), b_tok_touch_all: 3.0 (0.6%), b_finish: 0.66 (0.1%), tests_pri_0: 466 (89.8%), tests_pri_500: 4.0 (0.8%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH net] ipv6: Don't call with rt6_uncached_list_flush_dev X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As originally written rt6_uncached_list_flush_dev makes no sense when called with dev == NULL as it attempts to flush all uncached routes regardless of network namespace when dev == NULL. Which is simply incorrect behavior. Furthermore at the point rt6_ifdown is called with dev == NULL no more network devices exist in the network namespace so even if the code in rt6_uncached_list_flush_dev were to attempt something sensible it would be meaningless. Therefore remove support in rt6_uncached_list_flush_dev for handling network devices where dev == NULL, and only call rt6_uncached_list_flush_dev when rt6_ifdown is called with a network device. Fixes: 8d0b94afdca8 ("ipv6: Keep track of DST_NOCACHE routes in case of iface down/unregister") Signed-off-by: "Eric W. Biederman" --- net/ipv6/route.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index b8f85f143b69..1c45d7d90718 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -143,6 +143,9 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev) struct net_device *loopback_dev = net->loopback_dev; int cpu; + if (dev == loopback_dev) + return; + for_each_possible_cpu(cpu) { struct uncached_list *ul = per_cpu_ptr(&rt6_uncached_list, cpu); struct rt6_info *rt; @@ -152,14 +155,12 @@ static void rt6_uncached_list_flush_dev(struct net *net, struct net_device *dev) struct inet6_dev *rt_idev = rt->rt6i_idev; struct net_device *rt_dev = rt->dst.dev; - if (rt_idev && (rt_idev->dev == dev || !dev) && - rt_idev->dev != loopback_dev) { + if (rt_idev->dev == dev) { rt->rt6i_idev = in6_dev_get(loopback_dev); in6_dev_put(rt_idev); } - if (rt_dev && (rt_dev == dev || !dev) && - rt_dev != loopback_dev) { + if (rt_dev == dev) { rt->dst.dev = loopback_dev; dev_hold(rt->dst.dev); dev_put(rt_dev); @@ -2600,7 +2601,8 @@ void rt6_ifdown(struct net *net, struct net_device *dev) fib6_clean_all(net, fib6_ifdown, &adn); icmp6_clean_all(fib6_ifdown, &adn); - rt6_uncached_list_flush_dev(net, dev); + if (dev) + rt6_uncached_list_flush_dev(net, dev); } struct rt6_mtu_change_arg { -- 2.2.1