summaryrefslogtreecommitdiffstats
path: root/mm/mprotect.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-07 11:03:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-07 11:03:02 +0200
commitc610f7f772aa06ae2bd8e5ace87cde4d90f70198 (patch)
tree6991a32acd3d63685c184734869877707fa73d1c /mm/mprotect.c
parentstaging: lustre: orthography & coding style (diff)
parentLinux 4.0-rc7 (diff)
downloadlinux-c610f7f772aa06ae2bd8e5ace87cde4d90f70198.tar.xz
linux-c610f7f772aa06ae2bd8e5ace87cde4d90f70198.zip
Merge 4.0-rc7 into staging-next
We want those fixes (iio primarily) into the -next branch to help with merge and testing issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r--mm/mprotect.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 44727811bf4c..88584838e704 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -75,6 +75,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
oldpte = *pte;
if (pte_present(oldpte)) {
pte_t ptent;
+ bool preserve_write = prot_numa && pte_write(oldpte);
/*
* Avoid trapping faults against the zero or KSM
@@ -94,6 +95,8 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
ptent = ptep_modify_prot_start(mm, addr, pte);
ptent = pte_modify(ptent, newprot);
+ if (preserve_write)
+ ptent = pte_mkwrite(ptent);
/* Avoid taking write faults for known dirty pages */
if (dirty_accountable && pte_dirty(ptent) &&