diff options
-rw-r--r-- | kernel/futex.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index a283b3041072..dac8f4c5e020 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -250,6 +250,9 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) | |||
250 | return -EINVAL; | 250 | return -EINVAL; |
251 | address -= key->both.offset; | 251 | address -= key->both.offset; |
252 | 252 | ||
253 | if (unlikely(!access_ok(rw, uaddr, sizeof(u32)))) | ||
254 | return -EFAULT; | ||
255 | |||
253 | /* | 256 | /* |
254 | * PROCESS_PRIVATE futexes are fast. | 257 | * PROCESS_PRIVATE futexes are fast. |
255 | * As the mm cannot disappear under us and the 'key' only needs | 258 | * As the mm cannot disappear under us and the 'key' only needs |
@@ -258,8 +261,6 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) | |||
258 | * but access_ok() should be faster than find_vma() | 261 | * but access_ok() should be faster than find_vma() |
259 | */ | 262 | */ |
260 | if (!fshared) { | 263 | if (!fshared) { |
261 | if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))) | ||
262 | return -EFAULT; | ||
263 | key->private.mm = mm; | 264 | key->private.mm = mm; |
264 | key->private.address = address; | 265 | key->private.address = address; |
265 | get_futex_key_refs(key); | 266 | get_futex_key_refs(key); |