2005-05-25 11:27:43

by Miklos Szeredi

[permalink] [raw]
Subject: [PATCH] namespace.c: fix mnt_namespace zeroing for expired mounts

This patch clears mnt_namespace in an expired mount.

If mnt_namespace is not cleared, it's possible to attach a new mount
to the already detached mount, because check_mnt() can return true.

The effect is a resource leak, since the resulting tree will never be
freed.

An earlier patch doing the same for regular umount has already been
applied (namespacec-fix-mnt_namespace-clearing.patch).

Signed-off-by: Miklos Szeredi <[email protected]>

Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c 2005-05-22 11:52:56.000000000 +0200
+++ linux/fs/namespace.c 2005-05-22 11:52:59.000000000 +0200
@@ -843,6 +843,7 @@ static void expire_mount(struct vfsmount

/* delete from the namespace */
list_del_init(&mnt->mnt_list);
+ mnt->mnt_namespace = NULL;
detach_mnt(mnt, &old_nd);
spin_unlock(&vfsmount_lock);
path_release(&old_nd);