diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2010-02-10 12:15:53 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-05 11:08:46 -0700 |
commit | 23b5e014564bb71eb05871af019912957263f158 (patch) | |
tree | d7f1b2c484f6bcb0f44a6f89086f157f8001e7d0 /fs | |
parent | b1b7bf1eede2a2d954dc0e4e7db6bb94e7650f60 (diff) |
vfs: add NOFOLLOW flag to umount(2)
commit db1f05bb85d7966b9176e293f3ceead1cb8b5d79 upstream.
Add a new UMOUNT_NOFOLLOW flag to umount(2). This is needed to prevent
symlink attacks in unprivileged unmounts (fuse, samba, ncpfs).
Additionally, return -EINVAL if an unknown flag is used (and specify
an explicitly unused flag: UMOUNT_UNUSED). This makes it possible for
the caller to determine if a flag is supported or not.
CC: Eugene Teo <eugene@redhat.com>
CC: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namespace.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index efe02517654..2083810b5a2 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1132,8 +1132,15 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) { struct path path; int retval; + int lookup_flags = 0; - retval = user_path(name, &path); + if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW)) + return -EINVAL; + + if (!(flags & UMOUNT_NOFOLLOW)) + lookup_flags |= LOOKUP_FOLLOW; + + retval = user_path_at(AT_FDCWD, name, lookup_flags, &path); if (retval) goto out; retval = -EINVAL; |