https://github.com/torvalds/linux
Revision 68b47139ea94ab6d05e89c654db8daa99e9a232c authored by Miklos Szeredi on 07 August 2005, 16:42:25 UTC, committed by Linus Torvalds on 07 August 2005, 17:00:38 UTC
I'm resending this patch, because I still believe it's the correct fix. Tested before/after applying the patch with a test application available from: http://www.inf.bme.hu/~mszeredi/nstest.c Bind mount from a foreign namespace results in an un-removable mount. The reason is that mnt->mnt_namespace is copied from the old mount in clone_mnt(). Because of this check_mnt() in sys_umount() will fail. The solution is to set mnt->mnt_namespace to current->namespace in clone_mnt(). clone_mnt() is either called from do_loopback() or copy_tree(). copy_tree() is called from do_loopback() or copy_namespace(). When called (directly or indirectly) from do_loopback(), always current->namspace is being modified: check_mnt(nd->mnt). So setting mnt->mnt_namespace to current->namspace is the right thing to do. When called from copy_namespace(), the setting of mnt_namespace is irrelevant, since mnt_namespace is reset later in that function for all copied mounts. Jamie said: This patch is correct. The old code was buggy for more fundamental and serious reason: it broke the invariant that a tree of vfsmnts all have the same value of mnt_namespace (and the same for the mnt_list list). Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Acked-by: Jamie Lokier <jamie@shareable.org> Cc: <viro@parcelfarce.linux.theplanet.co.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 9ae5b3c
Tip revision: 68b47139ea94ab6d05e89c654db8daa99e9a232c authored by Miklos Szeredi on 07 August 2005, 16:42:25 UTC
[PATCH] namespace.c: fix bind mount from foreign namespace
[PATCH] namespace.c: fix bind mount from foreign namespace
Tip revision: 68b4713
File | Mode | Size |
---|---|---|
Documentation | ||
arch | ||
crypto | ||
drivers | ||
fs | ||
include | ||
init | ||
ipc | ||
kernel | ||
lib | ||
mm | ||
net | ||
scripts | ||
security | ||
sound | ||
usr | ||
COPYING | -rw-r--r-- | 18.3 KB |
CREDITS | -rw-r--r-- | 87.3 KB |
MAINTAINERS | -rw-r--r-- | 57.3 KB |
Makefile | -rw-r--r-- | 43.4 KB |
README | -rw-r--r-- | 14.2 KB |
REPORTING-BUGS | -rw-r--r-- | 3.0 KB |
Computing file changes ...