diff options
-rw-r--r-- | kernel/posix-cpu-timers.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 03c5d6c3e614..71a07699a36b 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -271,12 +271,22 @@ static int posix_cpu_clock_get_task(struct task_struct *tsk, | |||
271 | if (same_thread_group(tsk, current)) | 271 | if (same_thread_group(tsk, current)) |
272 | err = cpu_clock_sample(which_clock, tsk, &rtn); | 272 | err = cpu_clock_sample(which_clock, tsk, &rtn); |
273 | } else { | 273 | } else { |
274 | read_lock(&tasklist_lock); | 274 | unsigned long flags; |
275 | struct sighand_struct *sighand; | ||
275 | 276 | ||
276 | if (tsk->sighand && (tsk == current || thread_group_leader(tsk))) | 277 | /* |
278 | * while_each_thread() is not yet entirely RCU safe, | ||
279 | * keep locking the group while sampling process | ||
280 | * clock for now. | ||
281 | */ | ||
282 | sighand = lock_task_sighand(tsk, &flags); | ||
283 | if (!sighand) | ||
284 | return err; | ||
285 | |||
286 | if (tsk == current || thread_group_leader(tsk)) | ||
277 | err = cpu_clock_sample_group(which_clock, tsk, &rtn); | 287 | err = cpu_clock_sample_group(which_clock, tsk, &rtn); |
278 | 288 | ||
279 | read_unlock(&tasklist_lock); | 289 | unlock_task_sighand(tsk, &flags); |
280 | } | 290 | } |
281 | 291 | ||
282 | if (!err) | 292 | if (!err) |