Commit 324e82a3 authored by Yann Droneaud's avatar Yann Droneaud Committed by Luis Henriques

perf/x86: Fix copy_from_user_nmi() return if range is not ok

commit ebf2d268 upstream.

Commit 0a196848 ("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 0a196848, the function should be
fixed to return the total number of bytes if range is
not correct.
Signed-off-by: default avatarYann Droneaud <ydroneaud@opteya.com>
Signed-off-by: default avatarPeter 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.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent f912b3e0
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment