]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - security/commoncap.c
hyperv-fb: add pci stub
[karo-tx-linux.git] / security / commoncap.c
index c44b6fe6648e6945518db1a1be1c66b43131b875..b9d613e0ef143b36bd411246d1ce1f42f00738b0 100644 (file)
@@ -768,16 +768,16 @@ int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
  */
 static int cap_safe_nice(struct task_struct *p)
 {
-       int is_subset;
+       int is_subset, ret = 0;
 
        rcu_read_lock();
        is_subset = cap_issubset(__task_cred(p)->cap_permitted,
                                 current_cred()->cap_permitted);
+       if (!is_subset && !ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE))
+               ret = -EPERM;
        rcu_read_unlock();
 
-       if (!is_subset && !capable(CAP_SYS_NICE))
-               return -EPERM;
-       return 0;
+       return ret;
 }
 
 /**
@@ -824,7 +824,7 @@ int cap_task_setnice(struct task_struct *p, int nice)
  */
 static long cap_prctl_drop(struct cred *new, unsigned long cap)
 {
-       if (!capable(CAP_SETPCAP))
+       if (!ns_capable(current_user_ns(), CAP_SETPCAP))
                return -EPERM;
        if (!cap_valid(cap))
                return -EINVAL;