Skip to content

Commit

Permalink
perf/x86: Check user address explicitly in copy_from_user_nmi()
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Sharma <asharma@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1334961696-19580-5-git-send-email-asharma@fb.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Arun Sharma authored and Ingo Molnar committed Jun 6, 2012
1 parent bc6ca7b commit db0dc75
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/x86/lib/usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/module.h>

#include <asm/word-at-a-time.h>
#include <linux/sched.h>

/*
* best effort, GUP based copy_from_user() that is NMI-safe
Expand All @@ -21,6 +22,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
void *map;
int ret;

if (__range_not_ok(from, n, TASK_SIZE) == 0)
return len;

do {
ret = __get_user_pages_fast(addr, 1, 0, &page);
if (!ret)
Expand Down

0 comments on commit db0dc75

Please sign in to comment.