提交 dab4079d 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

[S390] uaccess: use might_fault() instead of might_sleep()

Adds more checking in case lockdep is turned on.
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 205d7ab9
...@@ -131,7 +131,7 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) ...@@ -131,7 +131,7 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
#define put_user(x, ptr) \ #define put_user(x, ptr) \
({ \ ({ \
might_sleep(); \ might_fault(); \
__put_user(x, ptr); \ __put_user(x, ptr); \
}) })
...@@ -180,7 +180,7 @@ extern int __put_user_bad(void) __attribute__((noreturn)); ...@@ -180,7 +180,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
#define get_user(x, ptr) \ #define get_user(x, ptr) \
({ \ ({ \
might_sleep(); \ might_fault(); \
__get_user(x, ptr); \ __get_user(x, ptr); \
}) })
...@@ -231,7 +231,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) ...@@ -231,7 +231,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
static inline unsigned long __must_check static inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n) copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
might_sleep(); might_fault();
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
n = __copy_to_user(to, from, n); n = __copy_to_user(to, from, n);
return n; return n;
...@@ -282,7 +282,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n) ...@@ -282,7 +282,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
static inline unsigned long __must_check static inline unsigned long __must_check
copy_from_user(void *to, const void __user *from, unsigned long n) copy_from_user(void *to, const void __user *from, unsigned long n)
{ {
might_sleep(); might_fault();
if (access_ok(VERIFY_READ, from, n)) if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n); n = __copy_from_user(to, from, n);
else else
...@@ -299,7 +299,7 @@ __copy_in_user(void __user *to, const void __user *from, unsigned long n) ...@@ -299,7 +299,7 @@ __copy_in_user(void __user *to, const void __user *from, unsigned long n)
static inline unsigned long __must_check static inline unsigned long __must_check
copy_in_user(void __user *to, const void __user *from, unsigned long n) copy_in_user(void __user *to, const void __user *from, unsigned long n)
{ {
might_sleep(); might_fault();
if (__access_ok(from,n) && __access_ok(to,n)) if (__access_ok(from,n) && __access_ok(to,n))
n = __copy_in_user(to, from, n); n = __copy_in_user(to, from, n);
return n; return n;
...@@ -312,7 +312,7 @@ static inline long __must_check ...@@ -312,7 +312,7 @@ static inline long __must_check
strncpy_from_user(char *dst, const char __user *src, long count) strncpy_from_user(char *dst, const char __user *src, long count)
{ {
long res = -EFAULT; long res = -EFAULT;
might_sleep(); might_fault();
if (access_ok(VERIFY_READ, src, 1)) if (access_ok(VERIFY_READ, src, 1))
res = uaccess.strncpy_from_user(count, src, dst); res = uaccess.strncpy_from_user(count, src, dst);
return res; return res;
...@@ -321,7 +321,7 @@ strncpy_from_user(char *dst, const char __user *src, long count) ...@@ -321,7 +321,7 @@ strncpy_from_user(char *dst, const char __user *src, long count)
static inline unsigned long static inline unsigned long
strnlen_user(const char __user * src, unsigned long n) strnlen_user(const char __user * src, unsigned long n)
{ {
might_sleep(); might_fault();
return uaccess.strnlen_user(n, src); return uaccess.strnlen_user(n, src);
} }
...@@ -354,7 +354,7 @@ __clear_user(void __user *to, unsigned long n) ...@@ -354,7 +354,7 @@ __clear_user(void __user *to, unsigned long n)
static inline unsigned long __must_check static inline unsigned long __must_check
clear_user(void __user *to, unsigned long n) clear_user(void __user *to, unsigned long n)
{ {
might_sleep(); might_fault();
if (access_ok(VERIFY_WRITE, to, n)) if (access_ok(VERIFY_WRITE, to, n))
n = uaccess.clear_user(n, to); n = uaccess.clear_user(n, to);
return n; return n;
......
...@@ -512,7 +512,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) ...@@ -512,7 +512,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
BUG(); BUG();
} }
might_sleep(); might_fault();
do { do {
__vcpu_run(vcpu); __vcpu_run(vcpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册