aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/mmap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index facc1a75bd4f..938313c76d02 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1615,6 +1615,12 @@ static inline int expand_downwards(struct vm_area_struct *vma,
1615 */ 1615 */
1616 if (unlikely(anon_vma_prepare(vma))) 1616 if (unlikely(anon_vma_prepare(vma)))
1617 return -ENOMEM; 1617 return -ENOMEM;
1618
1619 address &= PAGE_MASK;
1620 error = security_file_mmap(0, 0, 0, 0, address, 1);
1621 if (error)
1622 return error;
1623
1618 anon_vma_lock(vma); 1624 anon_vma_lock(vma);
1619 1625
1620 /* 1626 /*
@@ -1622,8 +1628,6 @@ static inline int expand_downwards(struct vm_area_struct *vma,
1622 * is required to hold the mmap_sem in read mode. We need the 1628 * is required to hold the mmap_sem in read mode. We need the
1623 * anon_vma lock to serialize against concurrent expand_stacks. 1629 * anon_vma lock to serialize against concurrent expand_stacks.
1624 */ 1630 */
1625 address &= PAGE_MASK;
1626 error = 0;
1627 1631
1628 /* Somebody else might have raced and expanded it already */ 1632 /* Somebody else might have raced and expanded it already */
1629 if (address < vma->vm_start) { 1633 if (address < vma->vm_start) {