Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1933

kernel-2.6.18-238.el5.src.rpm

From: Peter Zijlstra <pzijlstr@redhat.com>
Date: Fri, 17 Oct 2008 22:11:30 +0200
Subject: [misc] futex: fixup futex compat for private futexes
Message-id: 1224274290.10548.6.camel@lappy.programming.kicks-ass.net
O-Subject: [PATCH RHEL5.3 BZ467459] futex: fixup futex compat for private futexes
Bugzilla: 467459
RH-Acked-by: Larry Woodman <lwoodman@redhat.com>

From: Anoop V. Chakkalakkal

Private futexes introduced a command modifier in the futex op field
(FUTEX_PRIVATE_FLAG), when interpreting the ops we need to filter this
flag out.

When introducing private futexes to rhel5, we apparently forgot about
the compat code..

Signed-off-by: Peter Zijlstra <pzijlstr@redhat.com>

diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index a31f13d..51cac1a 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -164,20 +164,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
 	struct timespec t;
 	unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
 	int val2 = 0;
+	int cmd = op & FUTEX_CMD_MASK;
 
-	if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
+	if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {
 		if (get_compat_timespec(&t, utime))
 			return -EFAULT;
 		if (!timespec_valid(&t))
 			return -EINVAL;
-		if (op == FUTEX_WAIT)
+		if (cmd == FUTEX_WAIT)
 			timeout = timespec_to_jiffies(&t) + 1;
 		else {
 			timeout = t.tv_sec;
 			val2 = t.tv_nsec;
 		}
 	}
-	if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE)
+	if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
 		val2 = (int) (unsigned long) utime;
 
 	return do_futex(uaddr, op, val, timeout, uaddr2, val2, val3);