aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 8d25fdc653be..8f87b14c7968 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1853,7 +1853,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
1853 struct vm_area_struct *vma; 1853 struct vm_area_struct *vma;
1854 struct vm_unmapped_area_info info; 1854 struct vm_unmapped_area_info info;
1855 1855
1856 if (len > TASK_SIZE) 1856 if (len > TASK_SIZE - mmap_min_addr)
1857 return -ENOMEM; 1857 return -ENOMEM;
1858 1858
1859 if (flags & MAP_FIXED) 1859 if (flags & MAP_FIXED)
@@ -1862,7 +1862,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
1862 if (addr) { 1862 if (addr) {
1863 addr = PAGE_ALIGN(addr); 1863 addr = PAGE_ALIGN(addr);
1864 vma = find_vma(mm, addr); 1864 vma = find_vma(mm, addr);
1865 if (TASK_SIZE - len >= addr && 1865 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
1866 (!vma || addr + len <= vma->vm_start)) 1866 (!vma || addr + len <= vma->vm_start))
1867 return addr; 1867 return addr;
1868 } 1868 }
@@ -1901,7 +1901,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1901 struct vm_unmapped_area_info info; 1901 struct vm_unmapped_area_info info;
1902 1902
1903 /* requested length too big for entire address space */ 1903 /* requested length too big for entire address space */
1904 if (len > TASK_SIZE) 1904 if (len > TASK_SIZE - mmap_min_addr)
1905 return -ENOMEM; 1905 return -ENOMEM;
1906 1906
1907 if (flags & MAP_FIXED) 1907 if (flags & MAP_FIXED)
@@ -1911,14 +1911,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
1911 if (addr) { 1911 if (addr) {
1912 addr = PAGE_ALIGN(addr); 1912 addr = PAGE_ALIGN(addr);
1913 vma = find_vma(mm, addr); 1913 vma = find_vma(mm, addr);
1914 if (TASK_SIZE - len >= addr && 1914 if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
1915 (!vma || addr + len <= vma->vm_start)) 1915 (!vma || addr + len <= vma->vm_start))
1916 return addr; 1916 return addr;
1917 } 1917 }
1918 1918
1919 info.flags = VM_UNMAPPED_AREA_TOPDOWN; 1919 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
1920 info.length = len; 1920 info.length = len;
1921 info.low_limit = PAGE_SIZE; 1921 info.low_limit = max(PAGE_SIZE, mmap_min_addr);
1922 info.high_limit = mm->mmap_base; 1922 info.high_limit = mm->mmap_base;
1923 info.align_mask = 0; 1923 info.align_mask = 0;
1924 addr = vm_unmapped_area(&info); 1924 addr = vm_unmapped_area(&info);