Article View: linux.kernel.netdev
Article #328[PATCH] mpls: unregister sysctls before network device teardown
From: Jérémy Jean
Date: Wed, 07 Oct 2026 20:12
Date: Wed, 07 Oct 2026 20:12
54 lines
8081 bytes
8081 bytes
On network namespace exit, loopback is freed before MPLS unregisters its
sysctls. A task can keep platform_labels open and write to it during exit.
The handler can then use the freed loopback device.
Unregister the sysctls in pre_exit.
Fixes: 7720c01f3f59 ("mpls: Add a sysctl to control the size of the mpls label table")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
---
net/mpls/af_mpls.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 17b78dc..ad4ad6f 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -2776,16 +2776,20 @@ static __net_init int mpls_net_init(struct net *net)
return 0;
}
-static __net_exit void mpls_net_exit(struct net *net)
+static __net_exit void mpls_net_pre_exit(struct net *net)
{
- struct mpls_route __rcu **platform_label;
- size_t platform_labels;
const struct ctl_table *table;
- unsigned int index;
table = net->mpls.ctl->ctl_table_arg;
unregister_net_sysctl_table(net->mpls.ctl);
kfree(table);
+}
+
+static __net_exit void mpls_net_exit(struct net *net)
+{
+ struct mpls_route __rcu **platform_label;
+ size_t platform_labels;
+ unsigned int index;
/* An rcu grace period has passed since there was a device in
* the network namespace (and thus the last in flight packet)
@@ -2816,6 +2820,7 @@ static __net_exit void mpls_net_exit(struct net *net)
static struct pernet_operations mpls_net_ops = {
.init = mpls_net_init,
+ .pre_exit = mpls_net_pre_exit,
.exit = mpls_net_exit,
};
--
2.47.3
Technical Details
Message-ID:
<20261007201237.171863-2-Jeremy.Jean@oss.cyber.gouv.fr>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342525-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342525-linux-kernel-netdev=dewy.ru From: Jeremy.Jean@oss.cyber.gouv.fr (Jérémy Jean) Newsgroups: linux.kernel.netdev Subject: [PATCH] mpls: unregister sysctls before network device teardown Date: Wed, 7 Oct 2026 20:12:37 +0000 Organization: Usenet Network Message-ID: <20261007201237.171863-2-Jeremy.Jean@oss.cyber.gouv.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="730107"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:JOWB1gocvLKr0ecLPxQwfpepJbg= sha256:s82DVtbVVjJcJArIJrJE1FIaOYF4g+PDTgM2yA1DPRk= sha1:16pbL+M9tI7qU02B0l04W+nq4EQ= sha256:opZLcbiA3sGqvJp1XTRWmGsv+vXBvT67X5iK4C0DxfY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Source X-Source-Args X-Source-Dir X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D75DE10F23B; Wed, 7 Oct 2026 23:13:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -0.992 X-Spam-Status: No, score=-0.992 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m-zeu7Kv2B9Q; Wed, 7 Oct 2026 23:13:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-342525-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=oss.cyber.gouv.fr X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id C4B7D10F228; Wed, 7 Oct 2026 23:13:39 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 16E182A9BD; Wed, 7 Oct 2026 20:13:37 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E602B419FDA; Wed, 7 Oct 2026 20:13:34 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.b="V1M89s1a" X-Received: from oss.cyber.gouv.fr (oss.cyber.gouv.fr [51.159.188.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4934941835E; Wed, 7 Oct 2026 20:13:33 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.188.251 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791404014; cv=none; b=EoTGcUQNmdHNvqQhAaUlcrH8XGmXYxQj4Z8sm5bWoaSeWkF7cpv9YNGp4kC61gJUbk+x+P4hd3NCcIuaucUnP5GMcKkZeCYC5K6q6VZap6ZRbyPKmA6FYEbj4KtueB6cbmIG3YkUy9te9f4o+itFM9ILYkIB1U0Hdl3jTexER6U= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791404014; c=relaxed/simple; bh=MoRtXwbri/P/3kAqWKsbaW8ChXgK31gjKvSMDnMvVHg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S1Ac/Mn6iMZ5GLLL6UofJopBDmkUcko/ySQoSeo/oFoymLR2jBh0/DJKKc0xBwIJR5KZ65W5toe9GbELcSnS5uhcayTSKMtRdcIQnvxsKyq2RhWqHV3yvHbGq863bh3Yu7XflPqHmL3+pSZTRlw5b4ZswC5CAHiKQmfX7AM/hXA= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.cyber.gouv.fr; spf=pass smtp.mailfrom=oss.cyber.gouv.fr; dkim=pass (2048-bit key) header.d=oss.cyber.gouv.fr header.i=@oss.cyber.gouv.fr header.b=V1M89s1a; arc=none smtp.client-ip=51.159.188.251 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.cyber.gouv.fr X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.cyber.gouv.fr X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=oss.cyber.gouv.fr; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Sender:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=FoiOz8VHkvrdgUjKnshb5SbCQF0eAf8lvHBIs172X4I=; b=V1M89s1aZmI1HmY3Io7NFr7klm jt2JjYMK9JESdJrHUcdqlWuD7Ag38MqwRl3y21rY3exeIkFzrSs3+lkfDJZ5vQ+v34PrZnUN7UGqr PtWnv8mlINOdCsAJoX4340rsvrcpDq6NFpjlPjSuJtmJyjc5bt36QhD7l62+VjyVLXw6CnjNIu2UP P3uoouAd52nc1Tn4ldKxgrBYjKtHl+1BFl99ik68Xh5s0RupWF/ndYJyr9e/ZIeLfytj/M1/820nN 79JRBmS8OhNdnh/DBomeECnV/suCxLzREYzY2f17Q9IwTqm1EcPQW2sG1DqEZf21RvSCdhC/FtcWw tD3O7b3A==; X-Received: from [151.115.150.205] (port=33532 helo=gepetto..) by pf-012.whm.fr-par.scw.cloud with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from <Jeremy.Jean@oss.cyber.gouv.fr>) id 1xEY17-0000000HNc0-0ViY; Wed, 07 Oct 2026 22:13:30 +0200 X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>, stable@vger.kernel.org X-Mailer: git-send-email 2.47.3 X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - pf-012.whm.fr-par.scw.cloud X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - oss.cyber.gouv.fr X-Get-Message-Sender-Via: pf-012.whm.fr-par.scw.cloud: authenticated_id: jeremy.jean@oss.cyber.gouv.fr X-Authenticated-Sender: pf-012.whm.fr-par.scw.cloud: jeremy.jean@oss.cyber.gouv.fr