From: tip-bot for Yann Droneaud <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, hpa@zytor.com, mingo@kernel.org,
tglx@linutronix.de, ydroneaud@opteya.com,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org
Subject: [tip:perf/urgent] perf/x86: Fix copy_from_user_nmi() return if range is not ok
Date: Mon, 6 Jul 2015 08:34:33 -0700 [thread overview]
Message-ID: <tip-ebf2d2689de551d90965090bb991fc640a0c0d41@git.kernel.org> (raw)
In-Reply-To: <1435001923-30986-1-git-send-email-ydroneaud@opteya.com>
Commit-ID: ebf2d2689de551d90965090bb991fc640a0c0d41
Gitweb: http://git.kernel.org/tip/ebf2d2689de551d90965090bb991fc640a0c0d41
Author: Yann Droneaud <ydroneaud@opteya.com>
AuthorDate: Mon, 22 Jun 2015 21:38:43 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 6 Jul 2015 14:09:27 +0200
perf/x86: Fix copy_from_user_nmi() return if range is not ok
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>
---
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 ddf9ecb..e342586 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
next prev parent reply other threads:[~2015-07-06 15:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-22 19:38 [PATCH] x86: fix copy_from_user_nmi() return if range is not ok Yann Droneaud
2015-07-06 15:34 ` tip-bot for Yann Droneaud [this message]
2015-09-08 8:20 ` [-stable] perf/x86: Fix " Yann Droneaud
2015-09-28 13:18 ` Luis Henriques
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-ebf2d2689de551d90965090bb991fc640a0c0d41@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=ydroneaud@opteya.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox