diff options
author | Eugene Surovegin <ebs@ebshome.net> | 2006-03-28 13:13:12 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-28 21:44:15 -0500 |
commit | bab70a4af737f623de5b034976a311055308ab86 (patch) | |
tree | f8c0e9463de01323db2cb1a62f4eb83adb5ce7ca /arch/ppc/mm/pgtable.c | |
parent | bac30d1a78d0f11c613968fc8b351a91ed465386 (diff) |
[PATCH] lock PTE before updating it in 440/BookE page fault handler
Fix 44x and BookE page fault handler to correctly lock PTE before
trying to pte_update() it, otherwise this PTE might be swapped out
after pte_present() check but before pte_uptdate() call, resulting in
corrupted PTE. This can happen with enabled preemption and low memory
condition.
Signed-off-by: Eugene Surovegin <ebs@ebshome.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc/mm/pgtable.c')
-rw-r--r-- | arch/ppc/mm/pgtable.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c index a1924876cad6..706bca8eb144 100644 --- a/arch/ppc/mm/pgtable.c +++ b/arch/ppc/mm/pgtable.c | |||
@@ -368,7 +368,7 @@ void __init io_block_mapping(unsigned long virt, phys_addr_t phys, | |||
368 | * the PTE pointer is unmodified if PTE is not found. | 368 | * the PTE pointer is unmodified if PTE is not found. |
369 | */ | 369 | */ |
370 | int | 370 | int |
371 | get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep) | 371 | get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp) |
372 | { | 372 | { |
373 | pgd_t *pgd; | 373 | pgd_t *pgd; |
374 | pmd_t *pmd; | 374 | pmd_t *pmd; |
@@ -383,6 +383,8 @@ get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep) | |||
383 | if (pte) { | 383 | if (pte) { |
384 | retval = 1; | 384 | retval = 1; |
385 | *ptep = pte; | 385 | *ptep = pte; |
386 | if (pmdp) | ||
387 | *pmdp = pmd; | ||
386 | /* XXX caller needs to do pte_unmap, yuck */ | 388 | /* XXX caller needs to do pte_unmap, yuck */ |
387 | } | 389 | } |
388 | } | 390 | } |
@@ -420,7 +422,7 @@ unsigned long iopa(unsigned long addr) | |||
420 | mm = &init_mm; | 422 | mm = &init_mm; |
421 | 423 | ||
422 | pa = 0; | 424 | pa = 0; |
423 | if (get_pteptr(mm, addr, &pte)) { | 425 | if (get_pteptr(mm, addr, &pte, NULL)) { |
424 | pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK); | 426 | pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK); |
425 | pte_unmap(pte); | 427 | pte_unmap(pte); |
426 | } | 428 | } |