]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs/namespace: correctly handle errors returned by grab_requested_mnt_ns
authorAndrei Vagin <avagin@google.com>
Tue, 11 Nov 2025 06:28:15 +0000 (06:28 +0000)
committerChristian Brauner <brauner@kernel.org>
Wed, 12 Nov 2025 09:42:49 +0000 (10:42 +0100)
commit78f0e33cd6c939a555aa80dbed2fec6b333a7660
tree109ef3952fc5bc620bc4749ad675f86ab373695f
parenta3f8f8662771285511ae26c4c8d3ba1cd22159b9
fs/namespace: correctly handle errors returned by grab_requested_mnt_ns

grab_requested_mnt_ns was changed to return error codes on failure, but
its callers were not updated to check for error pointers, still checking
only for a NULL return value.

This commit updates the callers to use IS_ERR() or IS_ERR_OR_NULL() and
PTR_ERR() to correctly check for and propagate errors.

This also makes sure that the logic actually works and mount namespace
file descriptors can be used to refere to mounts.

Christian Brauner <brauner@kernel.org> says:

Rework the patch to be more ergonomic and in line with our overall error
handling patterns.

Fixes: 7b9d14af8777 ("fs: allow mount namespace fd")
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Andrei Vagin <avagin@google.com>
Link: https://patch.msgid.link/20251111062815.2546189-1-avagin@google.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c
include/uapi/linux/mount.h