aboutsummaryrefslogtreecommitdiff
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-02-01 12:03:41 +0800
committerAlex Shi <alex.shi@linaro.org>2018-02-01 12:03:41 +0800
commit9cebd248bd83dea5ead3f1ab5f3cbaf241588e37 (patch)
tree5f2d8fd7122c345045c476d57cb7c5ad17a4f08b /mm/mmap.c
parent4f0ca2b2718d297c88b1c303f2d414327c537636 (diff)
parent6c6f924f9c6294944ee6efb1bbd8cdb853582e50 (diff)
Merge tag 'v4.9.79' into linux-linaro-lsk-v4.9lsk-v4.9-18.02
This is the 4.9.79 stable release
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 5b48adb4aa56..45ac5b973459 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2240,7 +2240,8 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
gap_addr = TASK_SIZE;
next = vma->vm_next;
- if (next && next->vm_start < gap_addr) {
+ if (next && next->vm_start < gap_addr &&
+ (next->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {
if (!(next->vm_flags & VM_GROWSUP))
return -ENOMEM;
/* Check that both stack segments have the same anon_vma? */
@@ -2324,7 +2325,8 @@ int expand_downwards(struct vm_area_struct *vma,
if (gap_addr > address)
return -ENOMEM;
prev = vma->vm_prev;
- if (prev && prev->vm_end > gap_addr) {
+ if (prev && prev->vm_end > gap_addr &&
+ (prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {
if (!(prev->vm_flags & VM_GROWSDOWN))
return -ENOMEM;
/* Check that both stack segments have the same anon_vma? */