Commit f409adf5b1db55ece7e80b67a944f9c0d3fe93e9
1 parent
2b876f95d0
Exists in
master
and in
39 other branches
futex: Protect pid lookup in compat code with RCU
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 <tglx@linutronix.de> Cc: Darren Hart <dvhltc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org>
Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff
kernel/futex_compat.c
... | ... | @@ -146,7 +146,7 @@ |
146 | 146 | struct task_struct *p; |
147 | 147 | |
148 | 148 | ret = -ESRCH; |
149 | - read_lock(&tasklist_lock); | |
149 | + rcu_read_lock(); | |
150 | 150 | p = find_task_by_vpid(pid); |
151 | 151 | if (!p) |
152 | 152 | goto err_unlock; |
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | !capable(CAP_SYS_PTRACE)) |
158 | 158 | goto err_unlock; |
159 | 159 | head = p->compat_robust_list; |
160 | - read_unlock(&tasklist_lock); | |
160 | + rcu_read_unlock(); | |
161 | 161 | } |
162 | 162 | |
163 | 163 | if (put_user(sizeof(*head), len_ptr)) |
... | ... | @@ -165,7 +165,7 @@ |
165 | 165 | return put_user(ptr_to_compat(head), head_ptr); |
166 | 166 | |
167 | 167 | err_unlock: |
168 | - read_unlock(&tasklist_lock); | |
168 | + rcu_read_unlock(); | |
169 | 169 | |
170 | 170 | return ret; |
171 | 171 | } |