[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>

authored by Russell King and committed by Russell King 53cdb27a daf93dd5

+7 -3
+7 -3
arch/arm/mm/fault-armv.c
··· 37 pgd_t *pgd; 38 pmd_t *pmd; 39 pte_t *pte, entry; 40 - int ret = 0; 41 42 pgd = pgd_offset(vma->vm_mm, address); 43 if (pgd_none(*pgd)) ··· 55 entry = *pte; 56 57 /* 58 * If this page isn't present, or is already setup to 59 * fault (ie, is old), we can safely ignore any issues. 60 */ 61 - if (pte_present(entry) && pte_val(entry) & shared_pte_mask) { 62 flush_cache_page(vma, address, pte_pfn(entry)); 63 pte_val(entry) &= ~shared_pte_mask; 64 set_pte_at(vma->vm_mm, address, pte, entry); 65 flush_tlb_page(vma, address); 66 - ret = 1; 67 } 68 pte_unmap(pte); 69 return ret;
··· 37 pgd_t *pgd; 38 pmd_t *pmd; 39 pte_t *pte, entry; 40 + int ret; 41 42 pgd = pgd_offset(vma->vm_mm, address); 43 if (pgd_none(*pgd)) ··· 55 entry = *pte; 56 57 /* 58 + * If this page is present, it's actually being shared. 59 + */ 60 + ret = pte_present(entry); 61 + 62 + /* 63 * If this page isn't present, or is already setup to 64 * fault (ie, is old), we can safely ignore any issues. 65 */ 66 + if (ret && pte_val(entry) & shared_pte_mask) { 67 flush_cache_page(vma, address, pte_pfn(entry)); 68 pte_val(entry) &= ~shared_pte_mask; 69 set_pte_at(vma->vm_mm, address, pte, entry); 70 flush_tlb_page(vma, address); 71 } 72 pte_unmap(pte); 73 return ret;