Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1489250

[PATCH 4.7 168/184] sh: fix copy_from_user()

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.7 168/184] sh: fix copy_from_user()
Date 2016-09-22 20:00 +0200
Message-ID <skgrV-10r-71@gated-at.bofh.it> (permalink)
References <skgid-VW-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.7-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@zeniv.linux.org.uk>

commit 6e050503a150b2126620c1a1e9b3a368fcd51eac upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sh/include/asm/uaccess.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __us
 	__kernel_size_t __copy_size = (__kernel_size_t) n;
 
 	if (__copy_size && __access_ok(__copy_from, __copy_size))
-		return __copy_user(to, from, __copy_size);
+		__copy_size = __copy_user(to, from, __copy_size);
+
+	if (unlikely(__copy_size))
+		memset(to + (n - __copy_size), 0, __copy_size);
 
 	return __copy_size;
 }

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 4.7 168/184] sh: fix copy_from_user() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-09-22 20:00 +0200

csiph-web