Skip to content

Commit

Permalink
check privileges before setting mount propagation
Browse files Browse the repository at this point in the history
There's a missing check for CAP_SYS_ADMIN in do_change_type().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed May 8, 2007
1 parent 2f1a2cc commit ee6f958
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,9 @@ static int do_change_type(struct nameidata *nd, int flag)
int recurse = flag & MS_REC;
int type = flag & ~MS_REC;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

if (nd->dentry != nd->mnt->mnt_root)
return -EINVAL;

Expand Down

0 comments on commit ee6f958

Please sign in to comment.