Re: [PATCH] futex null pointer timeout

From: Pierre Peiffer
Date: Thu Jan 18 2007 - 07:29:04 EST


Ingo Molnar a écrit :
* Daniel Walker <dwalker@xxxxxxxxxx> wrote:

[...]
The patch reworks do_futex, and futex_wait* so a NULL pointer in the timeout position is infinite, and anything else is evaluated as a real timeout.

thanks, applied.


On top of this patch, you will need the following patch: futex_lock_pi is also involved.

---
futex.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---

Signed-off-by: Pierre Peiffer <pierre.peiffer@xxxxxxxx>

---
Index: linux-2.6/kernel/futex.c
===================================================================
--- linux-2.6.orig/kernel/futex.c 2007-01-18 13:16:32.000000000 +0100
+++ linux-2.6/kernel/futex.c 2007-01-18 13:19:32.000000000 +0100
@@ -1644,7 +1644,7 @@ static int futex_lock_pi(u32 __user *uad
if (refill_pi_state_cache())
return -ENOMEM;

- if (time->tv_sec || time->tv_nsec) {
+ if (time) {
to = &timeout;
hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
hrtimer_init_sleeper(to, current);
@@ -3197,7 +3197,7 @@ static int futex_lock_pi64(u64 __user *u
if (refill_pi_state_cache())
return -ENOMEM;

- if (time->tv_sec || time->tv_nsec) {
+ if (time) {
to = &timeout;
hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
hrtimer_init_sleeper(to, current);

--
Pierre
-
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/