diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -612,8 +612,6 @@ static unsigned long count_vma_pages_range(struct mm_struct *mm, | |||
612 | void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, | 612 | void __vma_link_rb(struct mm_struct *mm, struct vm_area_struct *vma, |
613 | struct rb_node **rb_link, struct rb_node *rb_parent) | 613 | struct rb_node **rb_link, struct rb_node *rb_parent) |
614 | { | 614 | { |
615 | WARN_ONCE(vma->vm_file && !vma->vm_ops, "missing vma->vm_ops"); | ||
616 | |||
617 | /* Update tracking information for the gap following the new vma. */ | 615 | /* Update tracking information for the gap following the new vma. */ |
618 | if (vma->vm_next) | 616 | if (vma->vm_next) |
619 | vma_gap_update(vma->vm_next); | 617 | vma_gap_update(vma->vm_next); |
@@ -1492,13 +1490,14 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) | |||
1492 | int vma_wants_writenotify(struct vm_area_struct *vma) | 1490 | int vma_wants_writenotify(struct vm_area_struct *vma) |
1493 | { | 1491 | { |
1494 | vm_flags_t vm_flags = vma->vm_flags; | 1492 | vm_flags_t vm_flags = vma->vm_flags; |
1493 | const struct vm_operations_struct *vm_ops = vma->vm_ops; | ||
1495 | 1494 | ||
1496 | /* If it was private or non-writable, the write bit is already clear */ | 1495 | /* If it was private or non-writable, the write bit is already clear */ |
1497 | if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED))) | 1496 | if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED))) |
1498 | return 0; | 1497 | return 0; |
1499 | 1498 | ||
1500 | /* The backer wishes to know when pages are first written to? */ | 1499 | /* The backer wishes to know when pages are first written to? */ |
1501 | if (vma->vm_ops && vma->vm_ops->page_mkwrite) | 1500 | if (vm_ops && (vm_ops->page_mkwrite || vm_ops->pfn_mkwrite)) |
1502 | return 1; | 1501 | return 1; |
1503 | 1502 | ||
1504 | /* The open routine did something to the protections that pgprot_modify | 1503 | /* The open routine did something to the protections that pgprot_modify |
@@ -1638,12 +1637,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr, | |||
1638 | */ | 1637 | */ |
1639 | WARN_ON_ONCE(addr != vma->vm_start); | 1638 | WARN_ON_ONCE(addr != vma->vm_start); |
1640 | 1639 | ||
1641 | /* All file mapping must have ->vm_ops set */ | ||
1642 | if (!vma->vm_ops) { | ||
1643 | static const struct vm_operations_struct dummy_ops = {}; | ||
1644 | vma->vm_ops = &dummy_ops; | ||
1645 | } | ||
1646 | |||
1647 | addr = vma->vm_start; | 1640 | addr = vma->vm_start; |
1648 | vm_flags = vma->vm_flags; | 1641 | vm_flags = vma->vm_flags; |
1649 | } else if (vm_flags & VM_SHARED) { | 1642 | } else if (vm_flags & VM_SHARED) { |