diff options
| author | Laurent Dufour <ldufour@linux.vnet.ibm.com> | 2017-09-08 19:13:12 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-08 21:26:47 -0400 |
| commit | de0c799bba2610a8e1e9a50d76a28614520a4cd4 (patch) | |
| tree | fd5cd44d785668802eb9a2982d1465be15270f39 /mm | |
| parent | 475d0487a2adb1718892856078861d430d81fc55 (diff) | |
mm/memory.c: fix mem_cgroup_oom_disable() call missing
Seen while reading the code, in handle_mm_fault(), in the case
arch_vma_access_permitted() is failing the call to
mem_cgroup_oom_disable() is not made.
To fix that, move the call to mem_cgroup_oom_enable() after calling
arch_vma_access_permitted() as it should not have entered the memcg OOM.
Link: http://lkml.kernel.org/r/1504625439-31313-1-git-send-email-ldufour@linux.vnet.ibm.com
Fixes: bae473a423f6 ("mm: introduce fault_env")
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/memory.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/memory.c b/mm/memory.c index 7c521a6ec7c6..0bbc1d612a63 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -4053,6 +4053,11 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, | |||
| 4053 | /* do counter updates before entering really critical section. */ | 4053 | /* do counter updates before entering really critical section. */ |
| 4054 | check_sync_rss_stat(current); | 4054 | check_sync_rss_stat(current); |
| 4055 | 4055 | ||
| 4056 | if (!arch_vma_access_permitted(vma, flags & FAULT_FLAG_WRITE, | ||
| 4057 | flags & FAULT_FLAG_INSTRUCTION, | ||
| 4058 | flags & FAULT_FLAG_REMOTE)) | ||
| 4059 | return VM_FAULT_SIGSEGV; | ||
| 4060 | |||
| 4056 | /* | 4061 | /* |
| 4057 | * Enable the memcg OOM handling for faults triggered in user | 4062 | * Enable the memcg OOM handling for faults triggered in user |
| 4058 | * space. Kernel faults are handled more gracefully. | 4063 | * space. Kernel faults are handled more gracefully. |
| @@ -4060,11 +4065,6 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address, | |||
| 4060 | if (flags & FAULT_FLAG_USER) | 4065 | if (flags & FAULT_FLAG_USER) |
| 4061 | mem_cgroup_oom_enable(); | 4066 | mem_cgroup_oom_enable(); |
| 4062 | 4067 | ||
| 4063 | if (!arch_vma_access_permitted(vma, flags & FAULT_FLAG_WRITE, | ||
| 4064 | flags & FAULT_FLAG_INSTRUCTION, | ||
| 4065 | flags & FAULT_FLAG_REMOTE)) | ||
| 4066 | return VM_FAULT_SIGSEGV; | ||
| 4067 | |||
| 4068 | if (unlikely(is_vm_hugetlb_page(vma))) | 4068 | if (unlikely(is_vm_hugetlb_page(vma))) |
| 4069 | ret = hugetlb_fault(vma->vm_mm, vma, address, flags); | 4069 | ret = hugetlb_fault(vma->vm_mm, vma, address, flags); |
| 4070 | else | 4070 | else |
