]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
fs: Allow CAP_SYS_ADMIN in s_user_ns to freeze and thaw filesystems
authorSeth Forshee <seth.forshee@canonical.com>
Sun, 15 Feb 2015 20:35:35 +0000 (14:35 -0600)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 24 May 2018 17:04:28 +0000 (12:04 -0500)
The user in control of a super block should be allowed to freeze
and thaw it. Relax the restrictions on the FIFREEZE and FITHAW
ioctls to require CAP_SYS_ADMIN in s_user_ns.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
fs/ioctl.c

index 4823431d1c9d4dc26f35df2327215ef56c94792e..b445b13fc59bd99cea023dc5835674833da4bd6e 100644 (file)
@@ -549,7 +549,7 @@ static int ioctl_fsfreeze(struct file *filp)
 {
        struct super_block *sb = file_inode(filp)->i_sb;
 
-       if (!capable(CAP_SYS_ADMIN))
+       if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
                return -EPERM;
 
        /* If filesystem doesn't support freeze feature, return. */
@@ -566,7 +566,7 @@ static int ioctl_fsthaw(struct file *filp)
 {
        struct super_block *sb = file_inode(filp)->i_sb;
 
-       if (!capable(CAP_SYS_ADMIN))
+       if (!ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
                return -EPERM;
 
        /* Thaw */