summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-27 10:35:54 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-27 10:35:54 +0100
commit53cdb27a933e4032934cbda0b447cfc9943c0eac (patch)
treebf19badff6f5d4353c7cbf7a5456407deedcbbff
parentdaf93dd55c48b65ab2f1907e0fc5ef994896c787 (diff)
downloadlinux-stable-53cdb27a933e4032934cbda0b447cfc9943c0eac.tar.gz
linux-stable-53cdb27a933e4032934cbda0b447cfc9943c0eac.tar.bz2
linux-stable-53cdb27a933e4032934cbda0b447cfc9943c0eac.zip
[ARM] Fix shared mmap when more than two maps of the same file exist
The shared mmap code works fine for the test case, which only checked for two shared maps of the same file. However, three shared maps result in one mapping remaining cached, resulting in stale data being visible via that mapping. Fix this. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mm/fault-armv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index fbfa26058442..a8ec97b4752e 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -37,7 +37,7 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte, entry;
- int ret = 0;
+ int ret;
pgd = pgd_offset(vma->vm_mm, address);
if (pgd_none(*pgd))
@@ -55,15 +55,19 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
entry = *pte;
/*
+ * If this page is present, it's actually being shared.
+ */
+ ret = pte_present(entry);
+
+ /*
* If this page isn't present, or is already setup to
* fault (ie, is old), we can safely ignore any issues.
*/
- if (pte_present(entry) && pte_val(entry) & shared_pte_mask) {
+ if (ret && pte_val(entry) & shared_pte_mask) {
flush_cache_page(vma, address, pte_pfn(entry));
pte_val(entry) &= ~shared_pte_mask;
set_pte_at(vma->vm_mm, address, pte, entry);
flush_tlb_page(vma, address);
- ret = 1;
}
pte_unmap(pte);
return ret;