From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net v2] ipv6: remove null_entry before adding default route Date: Tue, 09 Jan 2018 12:34:36 -0500 (EST) Message-ID: <20180109.123436.874984116978793472.davem@davemloft.net> References: <20180108183400.206017-1-tracywwnj@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, kafai@fb.com, edumazet@google.com To: weiwan@google.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:34940 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755356AbeAIReh (ORCPT ); Tue, 9 Jan 2018 12:34:37 -0500 In-Reply-To: <20180108183400.206017-1-tracywwnj@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Wei Wang Date: Mon, 8 Jan 2018 10:34:00 -0800 > From: Wei Wang > > In the current code, when creating a new fib6 table, tb6_root.leaf gets > initialized to net->ipv6.ip6_null_entry. > If a default route is being added with rt->rt6i_metric = 0xffffffff, > fib6_add() will add this route after net->ipv6.ip6_null_entry. As > null_entry is shared, it could cause problem. > > In order to fix it, set fn->leaf to NULL before calling > fib6_add_rt2node() when trying to add the first default route. > And reset fn->leaf to null_entry when adding fails or when deleting the > last default route. > > syzkaller reported the following issue which is fixed by this commit: ... > Reported-by: syzbot > Fixes: 66f5d6ce53e6 ("ipv6: replace rwlock with rcu and spinlock in fib6_table") > Signed-off-by: Wei Wang Applied, thank you.