aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-09-29 11:41:16 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2025-09-29 09:08:18 -0700
commit6c7ca6a02f8f9549a438a08a23c6327580ecf3d6 (patch)
tree393106284b1ae9863edadd8090d22dda52f39577
parentMerge tag 'vfs-6.18-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff)
downloadlinux-6c7ca6a02f8f9549a438a08a23c6327580ecf3d6.tar.gz
linux-6c7ca6a02f8f9549a438a08a23c6327580ecf3d6.zip
mount: handle NULL values in mnt_ns_release()
When calling in listmount() mnt_ns_release() may be passed a NULL pointer. Handle that case gracefully. Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/namespace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 38609066cf33..1ee17a00c311 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -180,7 +180,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns)
static void mnt_ns_release(struct mnt_namespace *ns)
{
/* keep alive for {list,stat}mount() */
- if (refcount_dec_and_test(&ns->passive)) {
+ if (ns && refcount_dec_and_test(&ns->passive)) {
fsnotify_mntns_delete(ns);
put_user_ns(ns->user_ns);
kfree(ns);