🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7414

[PATCH 7/8] lsm: fix the security_namespace_init() kernel-doc

#7414
From: Christian Brauner
Date: Mon, 26 Oct 2026 09:57
41 lines
9988 bytes
The kernel-doc claims that the owning user namespace is available via
ns->ops->owner(ns). But security_namespace_init() is called from
__ns_common_init() before the namespace has been set up. Apart from
network namespaces the owning user namespace isn't set at that point so
->owner() returns NULL. And for init_net with CONFIG_NET_NS=n ns->ops
itself is NULL.

What a namespace_init hook can rely on is the namespace type and, now
that it is allocated before the hook is called, the namespace id. So
document that instead.

No functional changes.

Fixes: f675d2e95569 ("lsm: add LSM blob and hooks for namespaces")
Cc: <stable@kernel.org> # mainline only
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
 security/security.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/security.c b/security/security.c
index 1e76c097b28d..81dac9e48a51 100644
--- a/security/security.c
+++ b/security/security.c
@@ -3382,9 +3382,9 @@ int security_create_user_ns(const struct cred *cred)
  * security_namespace_init() - Initialize LSM security data for a namespace
  * @ns: the namespace being initialized
  *
- * Initialize the LSM security blob attached to the namespace. The namespace type
- * is available via ns->ns_type, and the owning user namespace (if any)
- * via ns->ops->owner(ns).
+ * Initialize the LSM security blob attached to the namespace. The namespace
+ * hasn't been set up yet but its type and id are available via ns->ns_type
+ * and ns->ns_id.
  *
  * Return: Returns 0 if successful, otherwise < 0 error code.
  */

-- 
2.53.0
Technical Details
Message-ID: <20261026-work-security-namespace_free-v1-7-ffa3ebbf71bd@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351813-linux-kernel-netdev=dewy.ru
References: <20261026-work-security-namespace_free-v1-0-ffa3ebbf71bd@kernel.org>

Show 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-351813-linux-kernel-netdev=dewy.ru
From: brauner@kernel.org (Christian Brauner)
Newsgroups: linux.kernel.netdev
Subject: [PATCH 7/8] lsm: fix the security_namespace_init() kernel-doc
Date: Mon, 26 Oct 2026 10:57:15 +0100
Organization: Usenet Network
Message-ID: <20261026-work-security-namespace_free-v1-7-ffa3ebbf71bd@kernel.org>
References: <20261026-work-security-namespace_free-v1-0-ffa3ebbf71bd@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1277927"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:dLELFLx2A2f4UEmRE1Fv1AaZ518= sha256:jDIq5ewth7WbepodbhzQD5Vo6dxjVUVnk2+xtnBoIT8=
	sha1:HJmRnTJkc/2UTAtzq2cfgxZ/glU= sha256:X7aikGrXUW+9+6KIGl+NwFuHH3y3f4oa4M7IDNUeTWk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 65EE2125B99; Mon, 26 Oct 2026 13:06:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, 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=kernel.org
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 69HsXZUkLelx;
	Mon, 26 Oct 2026 13:06:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351813-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 71814125B96; Mon, 26 Oct 2026 13:05:43 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 1B15825223; Mon, 26 Oct 2026 09:58:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793008666;
	b=S+vAwIGes42zWzxGszfKMJeRIJRtwGlknV9FP4hjdIttOKfaZ6DAgqvXSHA6pwfyoydX
	 hICXV1Uu87AB+jz0/xCvTgu0AI21Mb/ZUlBh2m/OqZFC8nNvq5DkoESJ2A3D1wz2wtLKV
	 51/Yjj6H9YFhNAZ3/ND39bKhnXyYHtnqxqlXouDY8L9Jp40+5pcUPYCUX9yAKQ5ZUGkqd
	 6G3QgH/ZdgYgU1KnhwhJdPGXs1UOlfabt3oWklB9L47UdsghvVT/tZDaeGzH8W0NrhvFG
	 vKQvghIkbMAzPCtjQUM9zTh1Uk+XLV6j9bLnOp1AStBU2U4tmLDZtFhxhxvQhv2pGRw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793008666;
	h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	b=IGZ/UV/2BJ1wR5zrqm/nODvBjVTqrCugkRnyfmGxWLOWMmvJHpeeLG0Ues5b0e7lGQeS
	 8PjR7QdSVWSD2KJob0RpteoowCW9oKd1dxcdF0YZFr59ytmS7fyedAH1DoYw+knOVZ6ou
	 Y1kV4aIMLO0/QL5tUDEFA6NRnF1Zx81rgyMkymuf9JRWnK0SWNXT6KMioHk1XMmW0y4Mf
	 7syAn5yG/nKLO4xk+MVBaYZbnrswaJAQChRHSmGEO1nRDMt8UKiD4QMvWO1c+C4ssMuIM
	 K+zhuwCCn0fL64OeIhUwjButcV3Pz6Ehq1i1zrNDJu4EieV2tFYdtOv2+c5SAzMQ7TA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ied+n71Z;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A4DE1606A9C1;
	Mon, 26 Oct 2026 09:57:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ied+n71Z
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793008665;
	b=YzzobDX7DVD2728AJFA32ho5F7h9l/7lZKr3oaQku5xyB+QnxRg72KFtL+BmOaaWMugH
	 laC1dSMAPKJWv5XBTx8KwBjdnKzgXFGoixAu+7NoF4vZLtNC+8WEWIj3YtjD+W7+afhjX
	 rLmlHq6KEy9gVwcEyPIee1riXcZEA7EaYbTFgXOEl43tHOuKktCZ3PKXS+OzUrLBfXC8v
	 wtV+ag1T66RtiL3mwBOvIz/hmi7lZMj7+SqA0x4uInggRk5SdYK1IvxmJ07Wm0zDYAFpw
	 bV4eU+RoiAB+hpVHk5hTPkqCsCgy35LP/vj2SSqU7ZM4TfpzkZolFPzo9O6aUZNz8rA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793008665;
	h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	b=tIbtLCBYsMttk/i/kknkZtJU0ds9OWdFc0KKx6icF/l9Sg+sVQtz+ukWcPjFKcuBY23X
	 hiUOZv/yXqSS0xm2+A7/THo4k+DWgrFcS+6Be91g1qYRmBnna+jE0KoNri5uL/hJEQeJ8
	 NynzlQSRDAxmxffpKHJFi3XrKP+0r02brXZQ63C7zmAHUZ9Ptf64hcBLaMgnanBOssTx/
	 JcfyfaN7ncyY1uPAf3rHI3aX57Y91M9YnuCZmPcua8WKfGpdANDmLo0pLLUWv8WAGvOlw
	 4R8WTsdgLUatrINi6gKbSAGrZpr9ddTrh4kxXcX2yYzeA+SEroLc8B7AbOaC8GXbnHg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ied+n71Z;
	arc=none smtp.remote-ip=100.103.45.18
X-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 83564606A337;
	Mon, 26 Oct 2026 09:57:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 188431F01181;
	Mon, 26 Oct 2026 09:57:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793008665;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=ied+n71ZmjGazrwxKadThDhjyVKsR3+gZcKoUUSm9mbeQjlNHRUnvFPsARozjPoAL
	 0mkK6P3UPOdYMwoqOslfMaChzmglmpCUM2v/exNkO0wffkfRHJ5xChfgaTztpfVBuM
	 QfzPy8lNfupTfn7m6Yf7UZ/JuIDwk0HoW2wqPpcsE6I0yKSuosRkd2tui5PGBRdo4h
	 GY03jkOkmNIXx+Y/+4TUgK9yHtwP0WyBXLYAHvD3PUGuRymsqxaFVdGbOovZAxKvMB
	 xgEfyg19aH8BXfdR3e/FAi9syBGEflLN++Am+4cSEKbHN0l/sj5sA4BJgwUZPxuHMZ
	 iB75yaGNUP4Jw==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261026-work-security-namespace_free-v1-0-ffa3ebbf71bd@kernel.org>
X-Cc: linux-security-module@vger.kernel.org, 
 Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, 
 Paul Moore <paul@paul-moore.com>, netdev@vger.kernel.org, 
 "Christian Brauner (Amutable)" <brauner@kernel.org>, stable@kernel.org
X-Mailer: b4 0.17-dev-ce4c1
X-Developer-Signature: v=1; a=openpgp-sha256; l=1633; i=brauner@kernel.org;
 h=from:subject:message-id; bh=LU/y2L5eVemTv0E47phbRKaXIXa34YzJQ/j0ZrgeaAA=;
 b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWTdV2H6fOlDt6bK5Lk2F25pP+ZY6Pf9ievKAofLBg2ct
 6P0ctqLOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACYyVZeR4e6JTyYx7FPPioTs
 C0s/c1rGM37HqR4ROXHn42oCKuK60xj+Z/0ukk1RO3F8Tbmo36d+FfaF69e7zfxb0/bvUeru3JC
 17AA=
X-Developer-Key: i=brauner@kernel.org; a=openpgp;
 fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624