Skip to content

Commit

Permalink
futex: Protect pid lookup in compat code with RCU
Browse files Browse the repository at this point in the history
find_task_by_vpid() in compat_sys_get_robust_list() does not require
tasklist_lock. It can be protected with rcu_read_lock as done in
sys_get_robust_list() already.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Peter Zijlstra <[email protected]>
  • Loading branch information
KAGA-KOKO committed Dec 9, 2009
1 parent 2b876f9 commit f409adf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/futex_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
struct task_struct *p;

ret = -ESRCH;
read_lock(&tasklist_lock);
rcu_read_lock();
p = find_task_by_vpid(pid);
if (!p)
goto err_unlock;
Expand All @@ -157,15 +157,15 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
!capable(CAP_SYS_PTRACE))
goto err_unlock;
head = p->compat_robust_list;
read_unlock(&tasklist_lock);
rcu_read_unlock();
}

if (put_user(sizeof(*head), len_ptr))
return -EFAULT;
return put_user(ptr_to_compat(head), head_ptr);

err_unlock:
read_unlock(&tasklist_lock);
rcu_read_unlock();

return ret;
}
Expand Down

0 comments on commit f409adf

Please sign in to comment.