staging: lustre: hsm: permission checks for HSM ioctl operations
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 12 Apr 2016 20:14:15 +0000 (16:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2016 22:13:13 +0000 (15:13 -0700)
In the LL_IOC_HSM_CT_START case of ll_dir_ioctl() require
CAP_SYS_ADMIN, since the local handler for this ioctl may modify the
global KUC table.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866
Reviewed-on: http://review.whamcloud.com/7565
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/dir.c

index 1d5366b15a1b4e36b8fb03a4a367edfafe6afeb9..b457c28d0a29aadd8d0ce076c01968dd8f44b0f2 100644 (file)
@@ -1843,6 +1843,9 @@ out_quotactl:
                return rc;
        }
        case LL_IOC_HSM_CT_START:
+               if (!capable(CFS_CAP_SYS_ADMIN))
+                       return -EPERM;
+
                rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
                                    sizeof(struct lustre_kernelcomm));
                return rc;