Skip to content

Commit

Permalink
rt-mutex: fix chain walk early wakeup bug
Browse files Browse the repository at this point in the history
Alexey Kuznetsov found some problems in the pi-futex code.

One of the root causes is:

When a wakeup happens, we do not to stop the chain walk so we follow a not
longer relevant locking chain.

Drop out when this happens.

Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Alexey Kuznetsov <[email protected]>
Cc: Ulrich Drepper <[email protected]>
Cc: Eric Dumazet <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
KAGA-KOKO authored and Linus Torvalds committed Jun 9, 2007
1 parent c0d1d2b commit 1a539a8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kernel/rtmutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ int rt_mutex_adjust_prio_chain(struct task_struct *task,
if (!waiter || !waiter->task)
goto out_unlock_pi;

/*
* Check the orig_waiter state. After we dropped the locks,
* the previous owner of the lock might have released the lock
* and made us the pending owner:
*/
if (orig_waiter && !orig_waiter->task)
goto out_unlock_pi;

/*
* Drop out, when the task has no waiters. Note,
* top_waiter can be NULL, when we are in the deboosting
* mode!
*/
if (top_waiter && (!task_has_pi_waiters(task) ||
top_waiter != task_top_pi_waiter(task)))
goto out_unlock_pi;
Expand Down

0 comments on commit 1a539a8

Please sign in to comment.