Merge tag 'vfio-v3.14-rc1' of git://github.com/awilliam/linux-vfio
[cascardo/linux.git] / mm / mprotect.c
index bb53a65..7332c17 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/mmu_notifier.h>
 #include <linux/migrate.h>
 #include <linux/perf_event.h>
+#include <linux/ksm.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
@@ -63,7 +64,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 
                                ptent = *pte;
                                page = vm_normal_page(vma, addr, oldpte);
-                               if (page) {
+                               if (page && !PageKsm(page)) {
                                        if (!pte_numa(oldpte)) {
                                                ptent = pte_mknuma(ptent);
                                                set_pte_at(mm, addr, pte, ptent);