mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [-rt potential bug?] Bad error path in futex_wake
@ 2006-05-16  2:12 john stultz
  0 siblings, 0 replies; only message in thread
From: john stultz @ 2006-05-16  2:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Thomas Gleixner, lkml, Dinakar Guniguntala

Hey Ingo,
	I've been trying to help Dinakar chase down a futex bug where
lookup_pi_state oopses due to this->pi_state being NULL
(kernel/futex.c:480).

No clue on why yet, but looking over the code, I noticed the following
odd error path:

static int futex_wake(u32 __user *uaddr, int nr_wake)
{
        [snip]
	down_read(&current->mm->mmap_sem);

	ret = get_futex_key(uaddr, &key);
	if (unlikely(ret != 0))
		goto out;

	hb = hash_futex(&key);
	spin_lock(&hb->lock);
	head = &hb->chain;

	list_for_each_entry_safe(this, next, head, list) {
		if (match_futex (&this->key, &key)) {
			if (this->pi_state)
!!!!------>			return -EINVAL;
			wake_futex(this);
			if (++ret >= nr_wake)
				break;
		}
	}

	spin_unlock(&hb->lock);
out:
	up_read(&current->mm->mmap_sem);
	return ret;
}

I'm not very familiar w/ the futex code, so this might be the right
thing, but it sure looks wrong.

Thoughts?

thanks
-john


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-16  2:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-16  2:12 [-rt potential bug?] Bad error path in futex_wake john stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®