[PATCH 5/9] mm: uml pte atomicity

From: Hugh Dickins
Date: Sat Oct 22 2005 - 11:27:09 EST


There's usually a good reason when a pte is examined without the lock;
but it makes me nervous when the pointer is dereferenced more than once.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
---

arch/um/kernel/process_kern.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

--- mm4/arch/um/kernel/process_kern.c 2005-10-17 12:05:14.000000000 +0100
+++ mm5/arch/um/kernel/process_kern.c 2005-10-22 14:06:58.000000000 +0100
@@ -222,6 +222,7 @@ void *um_virt_to_phys(struct task_struct
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
+ pte_t ptent;

if(task->mm == NULL)
return(ERR_PTR(-EINVAL));
@@ -238,12 +239,13 @@ void *um_virt_to_phys(struct task_struct
return(ERR_PTR(-EINVAL));

pte = pte_offset_kernel(pmd, addr);
- if(!pte_present(*pte))
+ ptent = *pte;
+ if(!pte_present(ptent))
return(ERR_PTR(-EINVAL));

if(pte_out != NULL)
- *pte_out = *pte;
- return((void *) (pte_val(*pte) & PAGE_MASK) + (addr & ~PAGE_MASK));
+ *pte_out = ptent;
+ return((void *) (pte_val(ptent) & PAGE_MASK) + (addr & ~PAGE_MASK));
}

char *current_cmd(void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/