From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382815; b=OeuXKdFDkMoF60iL5U87m4QLM83e4u9psKEgBz5GG7vhKxj1HH4NZov/fzmLCT6Zmk4I JxfNLYIhlqQQuz6zA85dgUNIK0WoPBJ1jO6IJx2cGNBfy5kVgo85geuGo6mgf2XVouhlX F+vjF8px0dW2htORlrC1WB5puxGFaeY05aPr0GhQEzArn7nLAOzzQTiiGBW8GS1HgPnX1 jS4l+hhbTPsOeSR1IsLftJNC/kB0WoXsfb/C7w2MTBI+TOC9oAbFzvgAykdzXopkK9cQS TYUpgwwX9K0R+dd0FKXoV+6hU8M6CE1xiAjJnT7YnwhyGQj8XpSD2WzaLSHMhqNfHKg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382815; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=j70jOhOA8LsjC1leTInVvE2qjrVARVL25ayJYhu5bx0=; b=1GjCGLJmUGGRIPJl5QH4bTM6n63zyDcaWZOHFlT1cyjtfRhcAOD+RwCfvJuwdg7PdkOA ZJjhILPoSoxOkxwli89Ig89ojKEelnyQsfAsjbZ7YMT29bxIjQ88pajNBWvbyulqMBHqi fl6DxcZ1AU7ulR6tYUku3Q1TLoS2k0F9D7pmz1Ymhzc1wzDnmNTZcs1c72gW7iZ+nuhaY emQXaVIwu+Jbwm6mO2jcq/T2QxEN2ixqkd5cIRjvT6z7KX+i1KBGBnQW5g8G5hXpCcrnz E5lj9jHcsC0NxTlgtt91DInwdspgzV7NlIs3SAYLmp2c3YrZxnFI1GDJwxDgEWlmxTA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FNa05R81; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13685606A681; Fri, 4 Dec 2026 11:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=FNa05R81 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C351E1F000C2; Fri, 4 Dec 2026 11:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382814; bh=j70jOhOA8LsjC1leTInVvE2qjrVARVL25ayJYhu5bx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FNa05R81LpeGRrmC1yccfxD5zAGHc91/240GC51E4qg0fA9D9QlT2gF0Xk5AKMYVf ndjZihHWqdW+QtIEHJj4mp5dQ10KhDKW1DAz8lMVLMT6ppa1Py63J6J55krvBoTAyw mVJBdgVFBgvul5FAmaoET1opTectJTUtuChrTfP4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kuniyuki Iwashima , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 610/703] ipv6: Remove FIB6_EXCEPTION_BUCKET_FLUSHED. Date: Fri, 4 Dec 2026 19:08:29 +0900 Message-ID: <20261204100644.000504311@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit c66d93e68728cfb5f40b40d0f24129d7768faf43 ] The FIB6_EXCEPTION_BUCKET_FLUSHED logic has been dead since added. Commit 0346ec2f080b ("ipv6: Prevent rt6_insert_exception() for dying fib6_info.") restored the original race protection in rt6_insert_exception() by reusing fib6_info.fib6_destroying. The flag now prevents two races for per-cpu and exception routes. Let's remove FIB6_EXCEPTION_BUCKET_FLUSHED and set fib6_destroying in fib6_purge_rt(). Signed-off-by: Kuniyuki Iwashima Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260926033355.3295550-1-kuniyu@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/ip6_fib.c | 14 +++++++------- net/ipv6/route.c | 45 --------------------------------------------- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 0ec46c65ee0b5..5914d050252ba 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -1043,12 +1043,6 @@ static int fib6_nh_drop_pcpu_from(struct fib6_nh *nh, void *_arg) static void fib6_drop_pcpu_from(struct fib6_info *f6i) { - /* Make sure rt6_make_pcpu_route() wont add other percpu routes - * while we are cleaning them here. - */ - f6i->fib6_destroying = 1; - mb(); /* paired with the cmpxchg() in rt6_make_pcpu_route() */ - if (f6i->nh) { rcu_read_lock(); nexthop_for_each_fib6_nh(f6i->nh, fib6_nh_drop_pcpu_from, f6i); @@ -1066,7 +1060,13 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn, { struct fib6_table *table = rt->fib6_table; - /* Flush all cached dst in exception table */ + /* Make sure rt6_make_pcpu_route() / rt6_insert_exception() + * will not add other percpu / exception routes after cleaning + * them up in __fib6_drop_pcpu_from() / rt6_flush_exceptions(). + */ + rt->fib6_destroying = 1; + mb(); /* paired with the cmpxchg() in rt6_make_pcpu_route() */ + fib6_drop_pcpu_from(rt); rt6_flush_exceptions(rt); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 9ea43498a1b3f..013b9a52df7d9 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1674,13 +1674,6 @@ static unsigned int fib6_mtu(const struct fib6_result *res) return mtu - lwtunnel_headroom(nh->fib_nh_lws, mtu); } -#define FIB6_EXCEPTION_BUCKET_FLUSHED 0x1UL - -/* used when the flushed bit is not relevant, only access to the bucket - * (ie., all bucket users except rt6_insert_exception); - * - * called under rcu lock; sometimes called with rt6_exception_lock held - */ static struct rt6_exception_bucket *fib6_nh_get_excptn_bucket(const struct fib6_nh *nh, spinlock_t *lock) @@ -1693,40 +1686,9 @@ struct rt6_exception_bucket *fib6_nh_get_excptn_bucket(const struct fib6_nh *nh, else bucket = rcu_dereference(nh->rt6i_exception_bucket); - /* remove bucket flushed bit if set */ - if (bucket) { - unsigned long p = (unsigned long)bucket; - - p &= ~FIB6_EXCEPTION_BUCKET_FLUSHED; - bucket = (struct rt6_exception_bucket *)p; - } - return bucket; } -static bool fib6_nh_excptn_bucket_flushed(struct rt6_exception_bucket *bucket) -{ - unsigned long p = (unsigned long)bucket; - - return !!(p & FIB6_EXCEPTION_BUCKET_FLUSHED); -} - -/* called with rt6_exception_lock held */ -static void fib6_nh_excptn_bucket_set_flushed(struct fib6_nh *nh, - spinlock_t *lock) -{ - struct rt6_exception_bucket *bucket; - unsigned long p; - - bucket = rcu_dereference_protected(nh->rt6i_exception_bucket, - lockdep_is_held(lock)); - - p = (unsigned long)bucket; - p |= FIB6_EXCEPTION_BUCKET_FLUSHED; - bucket = (struct rt6_exception_bucket *)p; - rcu_assign_pointer(nh->rt6i_exception_bucket, bucket); -} - static int rt6_insert_exception(struct rt6_info *nrt, const struct fib6_result *res) { @@ -1756,9 +1718,6 @@ static int rt6_insert_exception(struct rt6_info *nrt, goto out; } rcu_assign_pointer(nh->rt6i_exception_bucket, bucket); - } else if (fib6_nh_excptn_bucket_flushed(bucket)) { - err = -EINVAL; - goto out; } #ifdef CONFIG_IPV6_SUBTREES @@ -1829,10 +1788,6 @@ static void fib6_nh_flush_exceptions(struct fib6_nh *nh, struct fib6_info *from) if (!bucket) goto out; - /* Prevent rt6_insert_exception() to recreate the bucket list */ - if (!from) - fib6_nh_excptn_bucket_set_flushed(nh, &rt6_exception_lock); - for (i = 0; i < FIB6_EXCEPTION_BUCKET_SIZE; i++) { hlist_for_each_entry_safe(rt6_ex, tmp, &bucket->chain, hlist) { if (!from || -- 2.53.0