diff --git a/mm/mmap.c b/mm/mmap.c index b6d74b3dbbc25eb4ab73edc18ff46b5ba1fa5b96..1aeef6625e6a7e7c5c9c579c55c874b5132329cf 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1191,21 +1191,21 @@ unsigned long mmap_region(struct file *file, unsigned long addr, goto unmap_and_free_vma; if (vm_flags & VM_EXECUTABLE) added_exe_file_vma(mm); + + /* Can addr have changed?? + * + * Answer: Yes, several device drivers can do it in their + * f_op->mmap method. -DaveM + */ + addr = vma->vm_start; + pgoff = vma->vm_pgoff; + vm_flags = vma->vm_flags; } else if (vm_flags & VM_SHARED) { error = shmem_zero_setup(vma); if (error) goto free_vma; } - /* Can addr have changed?? - * - * Answer: Yes, several device drivers can do it in their - * f_op->mmap method. -DaveM - */ - addr = vma->vm_start; - pgoff = vma->vm_pgoff; - vm_flags = vma->vm_flags; - if (vma_wants_writenotify(vma)) vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);