Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod From: Greg Kroah-Hartman Newsgroups: linux.kernel Subject: [PATCH 4.4 111/118] parisc: fix copy_from_user() Date: Thu, 22 Sep 2016 19:40:03 +0200 Message-ID: References: X-Original-To: linux-kernel@vger.kernel.org X-Mailer: git-send-email 2.10.0 User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 42 Organization: linux.* mail to news gateway X-Original-Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro X-Original-Date: Thu, 22 Sep 2016 19:30:11 +0200 X-Original-Message-ID: <20160922172944.184156701@linuxfoundation.org> X-Original-References: <20160922172938.643879685@linuxfoundation.org> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1489150 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit aace880feea38875fbc919761b77e5732a3659ef upstream. Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- arch/parisc/include/asm/uaccess.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -10,6 +10,7 @@ #include #include +#include #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -245,13 +246,14 @@ static inline unsigned long __must_check unsigned long n) { int sz = __compiletime_object_size(to); - int ret = -EFAULT; + unsigned long ret = n; if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n)) ret = __copy_from_user(to, from, n); else copy_from_user_overflow(); - + if (unlikely(ret)) + memset(to + (n - ret), 0, ret); return ret; }