]> Pileus Git - ~andy/linux/blobdiff - mm/mprotect.c
mm: fix TLB flush race between migration, and change_protection_range
[~andy/linux] / mm / mprotect.c
index f8421722acb998c488fb45054d06e76b032c6d53..bb53a6591aea1373d6bc74d5bb3e847650af8d24 100644 (file)
@@ -188,6 +188,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma,
        BUG_ON(addr >= end);
        pgd = pgd_offset(mm, addr);
        flush_cache_range(vma, addr, end);
+       set_tlb_flush_pending(mm);
        do {
                next = pgd_addr_end(addr, end);
                if (pgd_none_or_clear_bad(pgd))
@@ -199,6 +200,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma,
        /* Only flush the TLB if we actually modified any entries: */
        if (pages)
                flush_tlb_range(vma, start, end);
+       clear_tlb_flush_pending(mm);
 
        return pages;
 }