Re: [patch] pi-futex: futex_wake() lockup fix
From: Andrew Morton
Date: Sat Jul 01 2006 - 03:21:49 EST
On Sat, 1 Jul 2006 09:07:46 +0200
Ingo Molnar <mingo@xxxxxxx> wrote:
> Subject: pi-futex: futex_wake() lockup fix
> From: Ingo Molnar <mingo@xxxxxxx>
>
> fix futex_wake() exit condition bug when handling the robust-list with
> PI futexes on them.
>
> (reported by Ulrich Drepper, debugged by the lock validator.)
>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
> ---
> kernel/futex.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> Index: linux/kernel/futex.c
> ===================================================================
> --- linux.orig/kernel/futex.c
> +++ linux/kernel/futex.c
> @@ -646,8 +646,10 @@ static int futex_wake(u32 __user *uaddr,
>
> list_for_each_entry_safe(this, next, head, list) {
> if (match_futex (&this->key, &key)) {
> - if (this->pi_state)
> - return -EINVAL;
> + if (this->pi_state) {
> + ret = -EINVAL;
> + break;
> + }
> wake_futex(this);
> if (++ret >= nr_wake)
> break;
Well that was rather a howler.
How did the lock validator help in identifying this?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/