Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / mm / mprotect.c
index 58b629b..e3309fc 100644 (file)
@@ -84,6 +84,11 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
                                if (!page || PageKsm(page))
                                        continue;
 
+                               /* Also skip shared copy-on-write pages */
+                               if (is_cow_mapping(vma->vm_flags) &&
+                                   page_mapcount(page) != 1)
+                                       continue;
+
                                /* Avoid TLB flush if possible */
                                if (pte_protnone(oldpte))
                                        continue;