Merge tag 'x86_shstk_for_6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / mm / mmap.c
index 514ced13c65c7c6450367488d1f103b2a77ea0d1..b56a7f0c9f856509a7a17eac92c71f2ce30b659c 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1182,11 +1182,11 @@ static inline bool file_mmap_ok(struct file *file, struct inode *inode,
  */
 unsigned long do_mmap(struct file *file, unsigned long addr,
                        unsigned long len, unsigned long prot,
-                       unsigned long flags, unsigned long pgoff,
-                       unsigned long *populate, struct list_head *uf)
+                       unsigned long flags, vm_flags_t vm_flags,
+                       unsigned long pgoff, unsigned long *populate,
+                       struct list_head *uf)
 {
        struct mm_struct *mm = current->mm;
-       vm_flags_t vm_flags;
        int pkey = 0;
 
        *populate = 0;
@@ -1246,7 +1246,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
         * to. we assume access permissions have been handled by the open
         * of the memory object, so we don't do any here.
         */
-       vm_flags = calc_vm_prot_bits(prot, pkey) | calc_vm_flag_bits(flags) |
+       vm_flags |= calc_vm_prot_bits(prot, pkey) | calc_vm_flag_bits(flags) |
                        mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
 
        if (flags & MAP_LOCKED)
@@ -1564,7 +1564,7 @@ retry:
        gap = mas.index;
        gap += (info->align_offset - gap) & info->align_mask;
        tmp = mas_next(&mas, ULONG_MAX);
-       if (tmp && (tmp->vm_flags & VM_GROWSDOWN)) { /* Avoid prev check if possible */
+       if (tmp && (tmp->vm_flags & VM_STARTGAP_FLAGS)) { /* Avoid prev check if possible */
                if (vm_start_gap(tmp) < gap + length - 1) {
                        low_limit = tmp->vm_end;
                        mas_reset(&mas);
@@ -1616,7 +1616,7 @@ retry:
        gap -= (gap - info->align_offset) & info->align_mask;
        gap_end = mas.last;
        tmp = mas_next(&mas, ULONG_MAX);
-       if (tmp && (tmp->vm_flags & VM_GROWSDOWN)) { /* Avoid prev check if possible */
+       if (tmp && (tmp->vm_flags & VM_STARTGAP_FLAGS)) { /* Avoid prev check if possible */
                if (vm_start_gap(tmp) <= gap_end) {
                        high_limit = vm_start_gap(tmp);
                        mas_reset(&mas);
@@ -2998,7 +2998,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 
        file = get_file(vma->vm_file);
        ret = do_mmap(vma->vm_file, start, size,
-                       prot, flags, pgoff, &populate, NULL);
+                       prot, flags, 0, pgoff, &populate, NULL);
        fput(file);
 out:
        mmap_write_unlock(mm);