fs: Add a missing permission check to do_umount
authorAndy Lutomirski <luto@amacapital.net>
Wed, 8 Oct 2014 19:32:47 +0000 (12:32 -0700)
committerAndy Lutomirski <luto@amacapital.net>
Wed, 8 Oct 2014 19:32:47 +0000 (12:32 -0700)
Accessing do_remount_sb should require global CAP_SYS_ADMIN, but
only one of the two call sites was appropriately protected.

Fixes CVE-2014-7975.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
fs/namespace.c

index ef42d9bee2121f8e6a68937a5ecaa7670721ded9..7f67b463a5b4dafb57373109c416bd67d671d6c1 100644 (file)
@@ -1356,6 +1356,8 @@ static int do_umount(struct mount *mnt, int flags)
                 * Special case for "unmounting" root ...
                 * we just try to remount it readonly.
                 */
+               if (!capable(CAP_SYS_ADMIN))
+                       return -EPERM;
                down_write(&sb->s_umount);
                if (!(sb->s_flags & MS_RDONLY))
                        retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);