diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-04-09 03:42:58 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-04-11 07:53:33 -0400 |
commit | fa255f51c95fd91b4d7bb50a0fdcca18dd47db21 (patch) | |
tree | d7fa3a8ca5b9663078f9847411d3a7a2a9c95d7a | |
parent | a960062e5826b88e75c3999db6e5997092da519b (diff) |
s390/uaccess: fix possible register corruption in strnlen_user_srst()
The whole point of the out-of-line strnlen_user_srst() function was to
avoid corruption of register 0 due to register asm assignment.
However 'somebody' :) forgot to remove the update_primary_asce() function
call, which may clobber register 0 contents.
So let's remove that call and also move the size check to the calling
function.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/lib/uaccess.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c index 23f866b4c7f1..7416efe8eae4 100644 --- a/arch/s390/lib/uaccess.c +++ b/arch/s390/lib/uaccess.c | |||
@@ -338,9 +338,6 @@ static inline unsigned long strnlen_user_srst(const char __user *src, | |||
338 | register unsigned long reg0 asm("0") = 0; | 338 | register unsigned long reg0 asm("0") = 0; |
339 | unsigned long tmp1, tmp2; | 339 | unsigned long tmp1, tmp2; |
340 | 340 | ||
341 | if (unlikely(!size)) | ||
342 | return 0; | ||
343 | update_primary_asce(current); | ||
344 | asm volatile( | 341 | asm volatile( |
345 | " la %2,0(%1)\n" | 342 | " la %2,0(%1)\n" |
346 | " la %3,0(%0,%1)\n" | 343 | " la %3,0(%0,%1)\n" |
@@ -359,6 +356,8 @@ static inline unsigned long strnlen_user_srst(const char __user *src, | |||
359 | 356 | ||
360 | unsigned long __strnlen_user(const char __user *src, unsigned long size) | 357 | unsigned long __strnlen_user(const char __user *src, unsigned long size) |
361 | { | 358 | { |
359 | if (unlikely(!size)) | ||
360 | return 0; | ||
362 | update_primary_asce(current); | 361 | update_primary_asce(current); |
363 | return strnlen_user_srst(src, size); | 362 | return strnlen_user_srst(src, size); |
364 | } | 363 | } |