diff options
author | Paul Moore <pmoore@redhat.com> | 2013-11-27 02:32:55 +0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2013-11-27 02:32:55 +0400 |
commit | dd0a11815a339d6deeea8357574f8126a8404c92 (patch) | |
tree | c3c743ac6323e1caf9e987d6946cc4b2333a8256 /security/commoncap.c | |
parent | 42d64e1add3a1ce8a787116036163b8724362145 (diff) | |
parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) | |
download | linux-dd0a11815a339d6deeea8357574f8126a8404c92.tar.xz |
Merge tag 'v3.12'
Linux 3.12
Diffstat (limited to 'security/commoncap.c')
-rw-r--r-- | security/commoncap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index c44b6fe6648e..b9d613e0ef14 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -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; |