diff options
Diffstat (limited to 'kernel/futex.c')
-rw-r--r-- | kernel/futex.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 8af10027514b..e06962132aaf 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -439,10 +439,11 @@ static void free_pi_state(struct futex_pi_state *pi_state) | |||
439 | static struct task_struct * futex_find_get_task(pid_t pid) | 439 | static struct task_struct * futex_find_get_task(pid_t pid) |
440 | { | 440 | { |
441 | struct task_struct *p; | 441 | struct task_struct *p; |
442 | uid_t euid = current_euid(); | ||
442 | 443 | ||
443 | rcu_read_lock(); | 444 | rcu_read_lock(); |
444 | p = find_task_by_vpid(pid); | 445 | p = find_task_by_vpid(pid); |
445 | if (!p || ((current->euid != p->euid) && (current->euid != p->uid))) | 446 | if (!p || (euid != p->euid && euid != p->uid)) |
446 | p = ERR_PTR(-ESRCH); | 447 | p = ERR_PTR(-ESRCH); |
447 | else | 448 | else |
448 | get_task_struct(p); | 449 | get_task_struct(p); |
@@ -1829,6 +1830,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, | |||
1829 | { | 1830 | { |
1830 | struct robust_list_head __user *head; | 1831 | struct robust_list_head __user *head; |
1831 | unsigned long ret; | 1832 | unsigned long ret; |
1833 | uid_t euid = current_euid(); | ||
1832 | 1834 | ||
1833 | if (!futex_cmpxchg_enabled) | 1835 | if (!futex_cmpxchg_enabled) |
1834 | return -ENOSYS; | 1836 | return -ENOSYS; |
@@ -1844,8 +1846,8 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr, | |||
1844 | if (!p) | 1846 | if (!p) |
1845 | goto err_unlock; | 1847 | goto err_unlock; |
1846 | ret = -EPERM; | 1848 | ret = -EPERM; |
1847 | if ((current->euid != p->euid) && (current->euid != p->uid) && | 1849 | if (euid != p->euid && euid != p->uid && |
1848 | !capable(CAP_SYS_PTRACE)) | 1850 | !capable(CAP_SYS_PTRACE)) |
1849 | goto err_unlock; | 1851 | goto err_unlock; |
1850 | head = p->robust_list; | 1852 | head = p->robust_list; |
1851 | rcu_read_unlock(); | 1853 | rcu_read_unlock(); |