From: Miklos Szeredi Date: Fri, 8 Jul 2005 00:57:27 +0000 (-0700) Subject: [PATCH] namespace.c: fix mnt_namespace zeroing for expired mounts X-Git-Tag: v2.6.13-rc3~217 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac0811538b40bb92d339d22364026ed91dfdd147;p=linux-2.6 [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. Signed-off-by: Miklos Szeredi Acked-by: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/namespace.c b/fs/namespace.c index 2b4635e43a..7fd56eeb21 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -847,6 +847,7 @@ static void expire_mount(struct vfsmount *mnt, struct list_head *mounts) /* 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);