diff options
| -rw-r--r-- | mm/memory.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index d0f0bef3be48..93e332d5ed77 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -1955,12 +1955,17 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, | |||
| 1955 | unsigned long address, unsigned int fault_flags) | 1955 | unsigned long address, unsigned int fault_flags) |
| 1956 | { | 1956 | { |
| 1957 | struct vm_area_struct *vma; | 1957 | struct vm_area_struct *vma; |
| 1958 | vm_flags_t vm_flags; | ||
| 1958 | int ret; | 1959 | int ret; |
| 1959 | 1960 | ||
| 1960 | vma = find_extend_vma(mm, address); | 1961 | vma = find_extend_vma(mm, address); |
| 1961 | if (!vma || address < vma->vm_start) | 1962 | if (!vma || address < vma->vm_start) |
| 1962 | return -EFAULT; | 1963 | return -EFAULT; |
| 1963 | 1964 | ||
| 1965 | vm_flags = (fault_flags & FAULT_FLAG_WRITE) ? VM_WRITE : VM_READ; | ||
| 1966 | if (!(vm_flags & vma->vm_flags)) | ||
| 1967 | return -EFAULT; | ||
| 1968 | |||
| 1964 | ret = handle_mm_fault(mm, vma, address, fault_flags); | 1969 | ret = handle_mm_fault(mm, vma, address, fault_flags); |
| 1965 | if (ret & VM_FAULT_ERROR) { | 1970 | if (ret & VM_FAULT_ERROR) { |
| 1966 | if (ret & VM_FAULT_OOM) | 1971 | if (ret & VM_FAULT_OOM) |
