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


Groups > linux.kernel > #1235972 > unrolled thread

[PATCH 3.16.y-ckt 122/133] perf/x86: Fix copy_from_user_nmi() return if range is not ok

Started byLuis Henriques <luis.henriques@canonical.com>
First post2015-09-30 12:00 +0200
Last post2015-09-30 12:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16.y-ckt 122/133] perf/x86: Fix copy_from_user_nmi() return if range is not ok Luis Henriques <luis.henriques@canonical.com> - 2015-09-30 12:00 +0200

#1235972 — [PATCH 3.16.y-ckt 122/133] perf/x86: Fix copy_from_user_nmi() return if range is not ok

FromLuis Henriques <luis.henriques@canonical.com>
Date2015-09-30 12:00 +0200
Subject[PATCH 3.16.y-ckt 122/133] perf/x86: Fix copy_from_user_nmi() return if range is not ok
Message-ID<qeml7-1mP-51@gated-at.bofh.it>
3.16.7-ckt18 -stable review patch.  If anyone has any objections, please let me know.

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

From: Yann Droneaud <ydroneaud@opteya.com>

commit ebf2d2689de551d90965090bb991fc640a0c0d41 upstream.

Commit 0a196848ca36 ("perf: Fix arch_perf_out_copy_user default"),
changes copy_from_user_nmi() to return the number of
remaining bytes so that it behave like copy_from_user().

Unfortunately, when the range is outside of the process
memory, the return value  is still the number of byte
copied, eg. 0, instead of the remaining bytes.

As all users of copy_from_user_nmi() were modified as
part of commit 0a196848ca36, the function should be
fixed to return the total number of bytes if range is
not correct.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1435001923-30986-1-git-send-email-ydroneaud@opteya.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 arch/x86/lib/usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index ddf9ecb53cc3..e342586db6e4 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -20,7 +20,7 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
 	unsigned long ret;
 
 	if (__range_not_ok(from, n, TASK_SIZE))
-		return 0;
+		return n;
 
 	/*
 	 * Even though this function is typically called from NMI/IRQ context
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web