From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 7AC85372076 for ; Fri, 12 Jun 2026 06:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781245955; cv=none; b=V09/epfRKYhea9CHvphlTKDSM39yROXdZMjavQWZpow3B4J1/V2hDGeIF8WzTRYm0HQ+k19w7pEsOPlSsNfFtc9NDyo3UFvPuwGiG59gQIuCot/VRk8uh5Hz3g4oGATWqGAoefYiaWnlD/UDVaTqHLqRT3VielVU/lx9oCWh5tU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781245955; c=relaxed/simple; bh=k5m72iPTHKYOPr1Czpwx53TfhLQtbdim5mJ0TYQ4R9w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=n6iMxsRF3D/yWE0gJDI/J2TGQX8uYmeENCDW7/P6Z5MxlCu+9tQebej0IKo1kqZYYvn3T6cfWfetKVO9ZWC/M8wxI247dN11bntpwDO+ZkCUhppzv7TUoekhRreE43lkHfFcQK5+e9BQwXpCft2R5u/Kz50jTvO8JQQucD3gBa0= 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=TnmHDcul; arc=none smtp.client-ip=209.85.216.74 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="TnmHDcul" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-36b982ec27aso507886a91.1 for ; Thu, 11 Jun 2026 23:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781245954; x=1781850754; 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=LzOv2pnDNRfaQO5QAYtzMap+eeJtaKsDfNMe3MP/Cr8=; b=TnmHDculfnQFs9bLpkDkPE4mVrVv5vcgVr13TiFwq8c/X0TIesSVeFzNkaThaJPgI1 qUuicFArNXEdktM16DfcyMn1F+qj+V1oe4qNe4UINSqALd2kX+FetRaDJob54dmxkPnp 8m/Lo1I3FJ477bk/Aw3dcqO11WwxA0j3cysGD5/ekh+UvoQsBxH+OUDWi4OdK5grUCoS wsbIxxxlLjnu3Xbvau4PGhkwKIohoxYA644UTjGg+FfQDrIqjH4V1gjDtGZyndY6BUz3 azHysaRrRVfyyWHNNES+caJ1KY+AU8ov9P4XoqxHSuUTB2tgzZjh3wH1GyGWzE0e9FzZ OXCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781245954; x=1781850754; 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=LzOv2pnDNRfaQO5QAYtzMap+eeJtaKsDfNMe3MP/Cr8=; b=Sr3OR1CEj/OxmYT3LWSPmOeEAYNLkRZj12aOFK4R1M2o4mRN4MICyV90pDn2u+Qrz5 Xa+bDiEWS+5mEYJnipVbtM7vqypCAP6anxAsUYGF21fUU0bhZKp/i1WtgRWSlkNMthf/ N9TLwwhXARXGuskFkWqbHLBPPlzwBEJv7/1UVFuGQQKMTjRtdcdDdQKro0awX+rugh+D 2O7+OeLn6YzZK7RxDhcD3g6ZGO77jqufegDLN0EdD9O1TlJix68Ui71d106jg0P3p4L9 8Tix8qxsbEQ2RgLvCBIBbkJh2RmBNKA0ZCm4ejm48cznpoR/EQKRd9n24O2BED30P0gd R2Hw== X-Forwarded-Encrypted: i=1; AFNElJ+LO+F+6VW6eUpgbWpSYr67eVA/H2yzHluzQofg38g8pzdX7y6JZOdZK0Y0C/pKfwvrtv5FT3I=@vger.kernel.org X-Gm-Message-State: AOJu0Ywox3uxcERlquy/d+h6sSLGFerhMEVFJLzTzOl0FzSjUOEPVIXz cyGwTIB3x7tYNrzEe/hfk2kYbcoPl9NjZIlmvs1gSAhO8X77wkDQbdR8AXSqDluDg96uwuMECFJ Ag+hKVQ== X-Received: from pjbbu4.prod.google.com ([2002:a17:90a:ee44:b0:36b:8132:e6f1]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:5346:b0:36b:9798:4f67 with SMTP id 98e67ed59e1d1-37a02229651mr1840941a91.8.1781245953562; Thu, 11 Jun 2026 23:32:33 -0700 (PDT) Date: Fri, 12 Jun 2026 06:32:06 +0000 In-Reply-To: <20260612063225.455191-1-kuniyu@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260612063225.455191-1-kuniyu@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260612063225.455191-4-kuniyu@google.com> Subject: [PATCH v1 net-next 3/5] ipv4: fib: Free net->ipv4.{fib_table_hash,notifier_ops} without RTNL. From: Kuniyuki Iwashima To: David Ahern , Ido Schimmel , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Kuniyuki Iwashima , Kuniyuki Iwashima , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" We will call ip_fib_net_exit() from ->exit_rtnl(). However, some paths will still access net->ipv4.fib_table_hash after ->exit_rtnl(). For example, fib_flush() is called from fib_disable_ip() for NETDEV_UNREGISTER. Let's move kfree(net->ipv4.fib_table_hash) and fib4_notifier_exit() from ip_fib_net_exit() to its caller. Signed-off-by: Kuniyuki Iwashima --- net/ipv4/fib_frontend.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 3b1bd53c7357..c3e3b5633fd0 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -1615,9 +1615,6 @@ static void ip_fib_net_exit(struct net *net) #ifdef CONFIG_IP_MULTIPLE_TABLES fib4_rules_exit(net); #endif - - kfree(net->ipv4.fib_table_hash); - fib4_notifier_exit(net); } static int __net_init fib_net_init(struct net *net) @@ -1653,6 +1650,9 @@ static int __net_init fib_net_init(struct net *net) rtnl_net_lock(net); ip_fib_net_exit(net); rtnl_net_unlock(net); + + kfree(net->ipv4.fib_table_hash); + fib4_notifier_exit(net); goto out; } @@ -1674,8 +1674,11 @@ static void __net_exit fib_net_exit_batch(struct list_head *net_list) } rtnl_unlock(); - list_for_each_entry(net, net_list, exit_list) + list_for_each_entry(net, net_list, exit_list) { + kfree(net->ipv4.fib_table_hash); + fib4_notifier_exit(net); fib4_semantics_exit(net); + } } static struct pernet_operations fib_net_ops = { -- 2.54.0.1136.gdb2ca164c4-goog