aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/uaccess.h')
-rw-r--r--arch/x86/include/asm/uaccess.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 7402eb4b509d..6a07c05956a6 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -7,6 +7,7 @@
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/preempt.h>
10#include <asm/asm.h> 11#include <asm/asm.h>
11#include <asm/page.h> 12#include <asm/page.h>
12#include <asm/smap.h> 13#include <asm/smap.h>
@@ -66,6 +67,12 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
66 __chk_range_not_ok((unsigned long __force)(addr), size, limit); \ 67 __chk_range_not_ok((unsigned long __force)(addr), size, limit); \
67}) 68})
68 69
70#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
71# define WARN_ON_IN_IRQ() WARN_ON_ONCE(!in_task())
72#else
73# define WARN_ON_IN_IRQ()
74#endif
75
69/** 76/**
70 * access_ok: - Checks if a user space pointer is valid 77 * access_ok: - Checks if a user space pointer is valid
71 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that 78 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
@@ -86,8 +93,11 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
86 * checks that the pointer is in the user space range - after calling 93 * checks that the pointer is in the user space range - after calling
87 * this function, memory access functions may still return -EFAULT. 94 * this function, memory access functions may still return -EFAULT.
88 */ 95 */
89#define access_ok(type, addr, size) \ 96#define access_ok(type, addr, size) \
90 likely(!__range_not_ok(addr, size, user_addr_max())) 97({ \
98 WARN_ON_IN_IRQ(); \
99 likely(!__range_not_ok(addr, size, user_addr_max())); \
100})
91 101
92/* 102/*
93 * The exception table consists of pairs of addresses relative to the 103 * The exception table consists of pairs of addresses relative to the