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

Paul Moore paul at paul-moore.com
Mon Nov 23 23:19:27 UTC 2026


On Thu, Oct 29, 2026 at 12:41 PM Christian Brauner <brauner at kernel.org> wrote:
>
> 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 at kernel.org> # mainline only
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
> ---
>  security/security.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

The way this patchset is structured this probably should be folded
into patch 4/7 as it doesn't make sense by itself.

Acked-by: Paul Moore <paul at paul-moore.com>

--
paul-moore.com



More information about the Linux-security-module-archive mailing list