diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1198,8 +1198,20 @@ munmap_back: | |||
1198 | goto free_vma; | 1198 | goto free_vma; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | if (vma_wants_writenotify(vma)) | 1201 | if (vma_wants_writenotify(vma)) { |
1202 | pgprot_t pprot = vma->vm_page_prot; | ||
1203 | |||
1204 | /* Can vma->vm_page_prot have changed?? | ||
1205 | * | ||
1206 | * Answer: Yes, drivers may have changed it in their | ||
1207 | * f_op->mmap method. | ||
1208 | * | ||
1209 | * Ensures that vmas marked as uncached stay that way. | ||
1210 | */ | ||
1202 | vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); | 1211 | vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); |
1212 | if (pgprot_val(pprot) == pgprot_val(pgprot_noncached(pprot))) | ||
1213 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
1214 | } | ||
1203 | 1215 | ||
1204 | vma_link(mm, vma, prev, rb_link, rb_parent); | 1216 | vma_link(mm, vma, prev, rb_link, rb_parent); |
1205 | file = vma->vm_file; | 1217 | file = vma->vm_file; |