Skip to content

Commit 3588a08

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
hrtimer: fix hrtimer_init_sleeper() users
this patch: commit 37bb6cb Author: Peter Zijlstra <a.p.zijlstra@chello.nl> Date: Fri Jan 25 21:08:32 2008 +0100 hrtimer: unlock hrtimer_wakeup Broke hrtimer_init_sleeper() users. It forgot to fix up the futex caller of this function to detect the failed queueing and messed up the do_nanosleep() caller in that it could leak a TASK_INTERRUPTIBLE state. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 24e1c13 commit 3588a08

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎kernel/futex.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,8 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared,
12521252
t.timer.expires = *abs_time;
12531253

12541254
hrtimer_start(&t.timer, t.timer.expires, HRTIMER_MODE_ABS);
1255+
if (!hrtimer_active(&t.timer))
1256+
t.task = NULL;
12551257

12561258
/*
12571259
* the timer could have already expired, in which

‎kernel/hrtimer.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,8 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
13151315

13161316
} while (t->task && !signal_pending(current));
13171317

1318+
__set_current_state(TASK_RUNNING);
1319+
13181320
return t->task == NULL;
13191321
}
13201322

0 commit comments

Comments
 (0)