summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/mprotect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 1e265be25f85..7c3628a8b486 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;
}