]> err.no Git - linux-2.6/blobdiff - mm/mmap.c
[NETFILTER]: xt_pkttype: IPv6 multicast address recognition
[linux-2.6] / mm / mmap.c
index 938313c76d02f4f6d9ef62471330836ae6448f73..bfa389fc6ded6a2a5892eec57ed6cd90bbd34d1e 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -912,6 +912,9 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
        if (!len)
                return -EINVAL;
 
+       if (!(flags & MAP_FIXED))
+               addr = round_hint_to_min(addr);
+
        error = arch_mmap_check(addr, len, flags);
        if (error)
                return error;
@@ -1617,7 +1620,7 @@ static inline int expand_downwards(struct vm_area_struct *vma,
                return -ENOMEM;
 
        address &= PAGE_MASK;
-       error = security_file_mmap(0, 0, 0, 0, address, 1);
+       error = security_file_mmap(NULL, 0, 0, 0, address, 1);
        if (error)
                return error;
 
@@ -1938,6 +1941,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
        if (is_hugepage_only_range(mm, addr, len))
                return -EINVAL;
 
+       error = security_file_mmap(NULL, 0, 0, 0, addr, 1);
+       if (error)
+               return error;
+
        flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 
        error = arch_mmap_check(addr, len, flags);