]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86: Fix copy_from_user_nmi() return if range is not ok
authorYann Droneaud <ydroneaud@opteya.com>
Mon, 22 Jun 2015 19:38:43 +0000 (21:38 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 6 Jul 2015 12:09:27 +0000 (14:09 +0200)
commit3b614ad6a1915f700fafc65495bfbcfd6cebf056
tree77702842fe09c6d4ca440c21637602a73b42f301
parentb2a928d983cbd12a991fa37e5ee3b364876c673b
perf/x86: Fix copy_from_user_nmi() return if range is not ok

Commit dcc75f3d190d ("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 dcc75f3d190d, 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>
arch/x86/lib/usercopy.c