summaryrefslogtreecommitdiffstats
path: root/arch/microblaze/include/asm/uaccess.h
diff options
context:
space:
mode:
authorSteven J. Magnani <steve@digidescorp.com>2011-02-10 12:12:13 -0600
committerMichal Simek <monstr@monstr.eu>2011-03-09 08:09:59 +0100
commit6f3946b421395ff853bc0bcdab9c26b50ebbba8f (patch)
tree1a0e73e7d933d1cae4b84ba720332f55d378952c /arch/microblaze/include/asm/uaccess.h
parent6f205a4c69037e4d8fdf33088a852b64500df012 (diff)
downloadblackbird-op-linux-6f3946b421395ff853bc0bcdab9c26b50ebbba8f.tar.gz
blackbird-op-linux-6f3946b421395ff853bc0bcdab9c26b50ebbba8f.zip
microblaze: Fix /dev/zero corruption from __clear_user()
A userland read of more than PAGE_SIZE bytes from /dev/zero results in (a) not all of the bytes returned being zero, and (b) memory corruption due to zeroing of bytes beyond the user buffer. This is caused by improper constraints on the assembly __clear_user function. The constrints don't indicate to the compiler that the pointer argument is modified. Since the function is inline, this results in double-incrementing of the pointer when __clear_user() is invoked through a multi-page read() of /dev/zero. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Acked-by: Michal Simek <monstr@monstr.eu> CC: stable@kernel.org
Diffstat (limited to 'arch/microblaze/include/asm/uaccess.h')
-rw-r--r--arch/microblaze/include/asm/uaccess.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index d840f4a2d3c9..5bb95a11880d 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -120,16 +120,16 @@ static inline unsigned long __must_check __clear_user(void __user *to,
{
/* normal memset with two words to __ex_table */
__asm__ __volatile__ ( \
- "1: sb r0, %2, r0;" \
+ "1: sb r0, %1, r0;" \
" addik %0, %0, -1;" \
" bneid %0, 1b;" \
- " addik %2, %2, 1;" \
+ " addik %1, %1, 1;" \
"2: " \
__EX_TABLE_SECTION \
".word 1b,2b;" \
".previous;" \
- : "=r"(n) \
- : "0"(n), "r"(to)
+ : "=r"(n), "=r"(to) \
+ : "0"(n), "1"(to)
);
return n;
}
OpenPOWER on IntegriCloud