fs: Add a missing permission check to do_umount
[firefly-linux-kernel-4.4.55.git] / fs / namespace.c
index 00409add4d9661f2511f647606e49fd1408729ee..7f6a9348c589502e200ca4bbc67ece96a3dcecdb 100644 (file)
@@ -1274,6 +1274,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);