diff --git a/mm/mprotect.c b/mm/mprotect.c index 1e265be25f85bee19d10ca8764473005cf143eb7..7c3628a8b486bce275c8370802eebb8bdfb23d56 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -153,7 +153,9 @@ static unsigned long change_protection_range(struct vm_area_struct *vma, dirty_accountable); } while (pgd++, addr = next, addr != end); - flush_tlb_range(vma, start, end); + /* Only flush the TLB if we actually modified any entries: */ + if (pages) + flush_tlb_range(vma, start, end); return pages; }