From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99B7133F8A1 for ; Thu, 4 Jun 2026 22:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780613250; cv=none; b=PpaX4uve0Mq8P316QnYiknvJCfAncMuueaoSZVOFcVIJQF6o+uu32cFXol4sLbGd6JOacRsXILTwK03cL6sydj6bwi70Gegif7PGnge5Q1qsBUWwnqtGNsiQRniXGT1I0s7+aEq5DQagjTZGWWvykWhyumSFo+F4XYpHUU5GzlE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780613250; c=relaxed/simple; bh=gH+GZwJFBeinisdV0VqY+4qBFwH40iTxSzO8b+UvK1k=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mWj94pyKivflnhJt6hWpD5uojdb+u0DH5fN6/2JkZt0suLvdB/677tbCNiUhDZSDDWx0BL5dwPr3JefGpY8QTmuJUh3yPY5Ft2gYypHUnca8LISzXlUywvLjm8hwCzgIe+PiThPuEgY1O53v7jCp1f+tVhQDW4S131x7WvzpwMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=p0tpiiRN; arc=none smtp.client-ip=209.85.216.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="p0tpiiRN" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-36d97a4e08fso1128786a91.0 for ; Thu, 04 Jun 2026 15:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780613248; x=1781218048; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+bPDgs/fa5RPFvG8fR4TUIVB0FsWdGFoesfioLm6zcw=; b=p0tpiiRNe7ZFewceFH0+4Bsv+EvzetZAvFxKzdOzePj4Ln4eiWeSbq+FCq54bYqTgZ YIMX7sVQQQUCqPA5ZyN3/iedKmb7aegf8sYlU1KMKIt+y1oLIxwKt5B3o52FS2iUWmkX 7AfBSNXd+8cWSnH+A8ldDRMdCaeQQZxoB/Ik9jV6pdb+ozq5SG08nWb5ZC+5VlmOxtFr gGIF85kXs5E4oz+yQjPB8PgxSShtNq9jf5rB5202EhSKpUd+/kbl3at4Z5XaxUhgHkpT lq29qUJnaMmV/nBqIFbk9FFEfqw+pyC9+Y7zRQvM7zvNnSuCTLKmSAqd079VBiDD2ThD qtmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780613248; x=1781218048; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+bPDgs/fa5RPFvG8fR4TUIVB0FsWdGFoesfioLm6zcw=; b=PtvrrUCz/CaJiLDw79j8y+rIP7w0KLTAs5TlEzCFPzQMENZau3sNLKX0JqclbiLMAg DACDVnnahWWHXWqEdiDZtKE6VDO+kKbDv3rVKE7CYQRamvgRXFAGN0dDRILbg17XL3vn iLGOWcvxM0QAYgG8iDGgXk5vk7+WwuSPOmQ2MzvyrOEVb+JS+aRVJYhlZxJ1UnuX81p9 3CJCgPM/LUeO7jY81O6cg6u9TSODLewfeYs7AL9myCEomkJmvQSJGM49EDX8A2hdGuJV 88Ulq5w3oY7L3Sj2a3nMAvZdd3HCQMuiDlkBytfgAzwV1WWFz7XA3SIJvTl+IkRuYdSK OOaA== X-Forwarded-Encrypted: i=1; AFNElJ+YAuw33E3Y4fMNKIuo0ovgxAsb+MYMp6pYhpij/MF7wK3Qkb1Hbs4IfyB5nvOK2CtsXa9E6fw=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7OTnmUq7h+gCBh3YA+4Vli12d2jYul3KJ0zCO5WuncrQo95CI +FWRe6Ht//Gi6C6IVXraa1XCeLl5IjYZelE7gWvB48Yay4Y4UEdah9D2p9ijjb8qJHBFeRi7JTU I/JogCw== X-Received: from pgk24.prod.google.com ([2002:a63:a18:0:b0:c82:7761:991a]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:5210:b0:36a:8240:2477 with SMTP id 98e67ed59e1d1-370f0967012mr790735a91.19.1780613247532; Thu, 04 Jun 2026 15:47:27 -0700 (PDT) Date: Thu, 4 Jun 2026 22:46:27 +0000 In-Reply-To: <20260604224712.3209821-1-kuniyu@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260604224712.3209821-1-kuniyu@google.com> X-Mailer: git-send-email 2.54.0.1032.g2f8565e1d1-goog Message-ID: <20260604224712.3209821-10-kuniyu@google.com> Subject: [PATCH v3 net-next 09/15] ip6mr: Call fib_rules_unregister() without RTNL. From: Kuniyuki Iwashima To: "David S . Miller" , David Ahern , Eric Dumazet , Ido Schimmel , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" fib_rules_unregister() removes ops from net->rules_ops under spinlock, calls ops->delete() for each rule, and frees the ops. ip6mr_rules_ops_template does not have ->delete(), and any operation does not require RTNL there. Let's move fib_rules_unregister() from ip6mr_rules_exit() to ip6mr_net_exit(). Signed-off-by: Kuniyuki Iwashima --- net/ipv6/ip6mr.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index ddbe06397d9c..bb613331ead2 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -259,6 +259,11 @@ static int __net_init ip6mr_rules_init(struct net *net) } static void __net_exit ip6mr_rules_exit(struct net *net) +{ + fib_rules_unregister(net->ipv6.mr6_rules_ops); +} + +static void __net_exit ip6mr_rules_exit_rtnl(struct net *net) { struct mr_table *mrt, *next; @@ -267,7 +272,6 @@ static void __net_exit ip6mr_rules_exit(struct net *net) list_del_rcu(&mrt->list); ip6mr_free_table(mrt); } - fib_rules_unregister(net->ipv6.mr6_rules_ops); } static int ip6mr_rules_dump(struct net *net, struct notifier_block *nb, @@ -328,6 +332,10 @@ static int __net_init ip6mr_rules_init(struct net *net) } static void __net_exit ip6mr_rules_exit(struct net *net) +{ +} + +static void __net_exit ip6mr_rules_exit_rtnl(struct net *net) { struct mr_table *mrt = rcu_dereference_protected(net->ipv6.mrt6, 1); @@ -1366,8 +1374,9 @@ static int __net_init ip6mr_net_init(struct net *net) remove_proc_entry("ip6_mr_vif", net->proc_net); proc_vif_fail: rtnl_lock(); - ip6mr_rules_exit(net); + ip6mr_rules_exit_rtnl(net); rtnl_unlock(); + ip6mr_rules_exit(net); #endif ip6mr_rules_fail: ip6mr_notifier_exit(net); @@ -1380,6 +1389,7 @@ static void __net_exit ip6mr_net_exit(struct net *net) remove_proc_entry("ip6_mr_cache", net->proc_net); remove_proc_entry("ip6_mr_vif", net->proc_net); #endif + ip6mr_rules_exit(net); ip6mr_notifier_exit(net); } @@ -1389,7 +1399,7 @@ static void __net_exit ip6mr_net_exit_batch(struct list_head *net_list) rtnl_lock(); list_for_each_entry(net, net_list, exit_list) - ip6mr_rules_exit(net); + ip6mr_rules_exit_rtnl(net); rtnl_unlock(); } -- 2.54.0.1032.g2f8565e1d1-goog