aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-07-27 05:35:54 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-27 05:35:54 -0400
commit53cdb27a933e4032934cbda0b447cfc9943c0eac (patch)
treebf19badff6f5d4353c7cbf7a5456407deedcbbff /arch/arm/mm
parentdaf93dd55c48b65ab2f1907e0fc5ef994896c787 (diff)
[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>
Diffstat (limited to 'arch/arm/mm')
-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)
37 pgd_t *pgd; 37 pgd_t *pgd;
38 pmd_t *pmd; 38 pmd_t *pmd;
39 pte_t *pte, entry; 39 pte_t *pte, entry;
40 int ret = 0; 40 int ret;
41 41
42 pgd = pgd_offset(vma->vm_mm, address); 42 pgd = pgd_offset(vma->vm_mm, address);
43 if (pgd_none(*pgd)) 43 if (pgd_none(*pgd))
@@ -55,15 +55,19 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
55 entry = *pte; 55 entry = *pte;
56 56
57 /* 57 /*
58 * If this page is present, it's actually being shared.
59 */
60 ret = pte_present(entry);
61
62 /*
58 * If this page isn't present, or is already setup to 63 * If this page isn't present, or is already setup to
59 * fault (ie, is old), we can safely ignore any issues. 64 * fault (ie, is old), we can safely ignore any issues.
60 */ 65 */
61 if (pte_present(entry) && pte_val(entry) & shared_pte_mask) { 66 if (ret && pte_val(entry) & shared_pte_mask) {
62 flush_cache_page(vma, address, pte_pfn(entry)); 67 flush_cache_page(vma, address, pte_pfn(entry));
63 pte_val(entry) &= ~shared_pte_mask; 68 pte_val(entry) &= ~shared_pte_mask;
64 set_pte_at(vma->vm_mm, address, pte, entry); 69 set_pte_at(vma->vm_mm, address, pte, entry);
65 flush_tlb_page(vma, address); 70 flush_tlb_page(vma, address);
66 ret = 1;
67 } 71 }
68 pte_unmap(pte); 72 pte_unmap(pte);
69 return ret; 73 return ret;