diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:23:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:23:52 -0400 |
commit | b80cd62b7d4406bbe8c573fe4381dcc71a2850fd (patch) | |
tree | b3fbd9dcaac45feefc554b5a46888b2cbec0c51d /arch/mips | |
parent | c345f60a5f58a65004f22fb0d257d65ec1528310 (diff) | |
parent | 07d5ecae2940ddd77746e2fb597dcf57d3c2e277 (diff) |
Merge branch 'core-futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
arm: Remove bogus comment in futex_atomic_cmpxchg_inatomic()
futex: Deobfuscate handle_futex_death()
plist: Add priority list test
plist: Shrink struct plist_head
futex,plist: Remove debug lock assignment from plist_node
futex,plist: Pass the real head of the priority list to plist_del()
futex: Sanitize futex ops argument types
futex: Sanitize cmpxchg_futex_value_locked API
futex: Remove redundant pagefault_disable in futex_atomic_cmpxchg_inatomic()
futex: Avoid redudant evaluation of task_pid_vnr()
futex: Update futex_wait_setup comments about locking
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/futex.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h index b9cce90346cf..6ebf1734b411 100644 --- a/arch/mips/include/asm/futex.h +++ b/arch/mips/include/asm/futex.h | |||
@@ -75,7 +75,7 @@ | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static inline int | 77 | static inline int |
78 | futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | 78 | futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) |
79 | { | 79 | { |
80 | int op = (encoded_op >> 28) & 7; | 80 | int op = (encoded_op >> 28) & 7; |
81 | int cmp = (encoded_op >> 24) & 15; | 81 | int cmp = (encoded_op >> 24) & 15; |
@@ -85,7 +85,7 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | |||
85 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) | 85 | if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) |
86 | oparg = 1 << oparg; | 86 | oparg = 1 << oparg; |
87 | 87 | ||
88 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) | 88 | if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32))) |
89 | return -EFAULT; | 89 | return -EFAULT; |
90 | 90 | ||
91 | pagefault_disable(); | 91 | pagefault_disable(); |
@@ -132,11 +132,13 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | static inline int | 134 | static inline int |
135 | futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | 135 | futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, |
136 | u32 oldval, u32 newval) | ||
136 | { | 137 | { |
137 | int retval; | 138 | int ret = 0; |
139 | u32 val; | ||
138 | 140 | ||
139 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) | 141 | if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) |
140 | return -EFAULT; | 142 | return -EFAULT; |
141 | 143 | ||
142 | if (cpu_has_llsc && R10000_LLSC_WAR) { | 144 | if (cpu_has_llsc && R10000_LLSC_WAR) { |
@@ -145,25 +147,25 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
145 | " .set push \n" | 147 | " .set push \n" |
146 | " .set noat \n" | 148 | " .set noat \n" |
147 | " .set mips3 \n" | 149 | " .set mips3 \n" |
148 | "1: ll %0, %2 \n" | 150 | "1: ll %1, %3 \n" |
149 | " bne %0, %z3, 3f \n" | 151 | " bne %1, %z4, 3f \n" |
150 | " .set mips0 \n" | 152 | " .set mips0 \n" |
151 | " move $1, %z4 \n" | 153 | " move $1, %z5 \n" |
152 | " .set mips3 \n" | 154 | " .set mips3 \n" |
153 | "2: sc $1, %1 \n" | 155 | "2: sc $1, %2 \n" |
154 | " beqzl $1, 1b \n" | 156 | " beqzl $1, 1b \n" |
155 | __WEAK_LLSC_MB | 157 | __WEAK_LLSC_MB |
156 | "3: \n" | 158 | "3: \n" |
157 | " .set pop \n" | 159 | " .set pop \n" |
158 | " .section .fixup,\"ax\" \n" | 160 | " .section .fixup,\"ax\" \n" |
159 | "4: li %0, %5 \n" | 161 | "4: li %0, %6 \n" |
160 | " j 3b \n" | 162 | " j 3b \n" |
161 | " .previous \n" | 163 | " .previous \n" |
162 | " .section __ex_table,\"a\" \n" | 164 | " .section __ex_table,\"a\" \n" |
163 | " "__UA_ADDR "\t1b, 4b \n" | 165 | " "__UA_ADDR "\t1b, 4b \n" |
164 | " "__UA_ADDR "\t2b, 4b \n" | 166 | " "__UA_ADDR "\t2b, 4b \n" |
165 | " .previous \n" | 167 | " .previous \n" |
166 | : "=&r" (retval), "=R" (*uaddr) | 168 | : "+r" (ret), "=&r" (val), "=R" (*uaddr) |
167 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) | 169 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) |
168 | : "memory"); | 170 | : "memory"); |
169 | } else if (cpu_has_llsc) { | 171 | } else if (cpu_has_llsc) { |
@@ -172,31 +174,32 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
172 | " .set push \n" | 174 | " .set push \n" |
173 | " .set noat \n" | 175 | " .set noat \n" |
174 | " .set mips3 \n" | 176 | " .set mips3 \n" |
175 | "1: ll %0, %2 \n" | 177 | "1: ll %1, %3 \n" |
176 | " bne %0, %z3, 3f \n" | 178 | " bne %1, %z4, 3f \n" |
177 | " .set mips0 \n" | 179 | " .set mips0 \n" |
178 | " move $1, %z4 \n" | 180 | " move $1, %z5 \n" |
179 | " .set mips3 \n" | 181 | " .set mips3 \n" |
180 | "2: sc $1, %1 \n" | 182 | "2: sc $1, %2 \n" |
181 | " beqz $1, 1b \n" | 183 | " beqz $1, 1b \n" |
182 | __WEAK_LLSC_MB | 184 | __WEAK_LLSC_MB |
183 | "3: \n" | 185 | "3: \n" |
184 | " .set pop \n" | 186 | " .set pop \n" |
185 | " .section .fixup,\"ax\" \n" | 187 | " .section .fixup,\"ax\" \n" |
186 | "4: li %0, %5 \n" | 188 | "4: li %0, %6 \n" |
187 | " j 3b \n" | 189 | " j 3b \n" |
188 | " .previous \n" | 190 | " .previous \n" |
189 | " .section __ex_table,\"a\" \n" | 191 | " .section __ex_table,\"a\" \n" |
190 | " "__UA_ADDR "\t1b, 4b \n" | 192 | " "__UA_ADDR "\t1b, 4b \n" |
191 | " "__UA_ADDR "\t2b, 4b \n" | 193 | " "__UA_ADDR "\t2b, 4b \n" |
192 | " .previous \n" | 194 | " .previous \n" |
193 | : "=&r" (retval), "=R" (*uaddr) | 195 | : "+r" (ret), "=&r" (val), "=R" (*uaddr) |
194 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) | 196 | : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) |
195 | : "memory"); | 197 | : "memory"); |
196 | } else | 198 | } else |
197 | return -ENOSYS; | 199 | return -ENOSYS; |
198 | 200 | ||
199 | return retval; | 201 | *uval = val; |
202 | return ret; | ||
200 | } | 203 | } |
201 | 204 | ||
202 | #endif | 205 | #endif |