X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=mm%2Fmprotect.c;h=360d9cc8b38c061185d562fc40b7f032ae34d21d;hb=6b312c0e6e2f44b020e12953d1dd37eed60e3609;hp=a5bf31c273757848ae7614bd9fc3c8595c493705;hpb=d939d2851fd12568e2eabb2916769e8a57ba5c89;p=mv-sheeva.git diff --git a/mm/mprotect.c b/mm/mprotect.c index a5bf31c2737..360d9cc8b38 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -47,19 +47,17 @@ static void change_pte_range(struct mm_struct *mm, pmd_t *pmd, if (pte_present(oldpte)) { pte_t ptent; - /* Avoid an SMP race with hardware updated dirty/clean - * bits by wiping the pte and then setting the new pte - * into place. - */ - ptent = ptep_get_and_clear(mm, addr, pte); + ptent = ptep_modify_prot_start(mm, addr, pte); ptent = pte_modify(ptent, newprot); + /* * Avoid taking write faults for pages we know to be * dirty. */ if (dirty_accountable && pte_dirty(ptent)) ptent = pte_mkwrite(ptent); - set_pte_at(mm, addr, pte, ptent); + + ptep_modify_prot_commit(mm, addr, pte, ptent); #ifdef CONFIG_MIGRATION } else if (!pte_file(oldpte)) { swp_entry_t entry = pte_to_swp_entry(oldpte); @@ -239,7 +237,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot) end = start + len; if (end <= start) return -ENOMEM; - if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) + if (!arch_validate_prot(prot)) return -EINVAL; reqprot = prot;