Skip to content

Commit

Permalink
[PATCH] mm: uml pte atomicity
Browse files Browse the repository at this point in the history
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@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Oct 30, 2005
1 parent a7e4705 commit 8f5cd76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/um/kernel/process_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
pte_t ptent;

if(task->mm == NULL)
return(ERR_PTR(-EINVAL));
Expand All @@ -238,12 +239,13 @@ void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
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)
Expand Down

0 comments on commit 8f5cd76

Please sign in to comment.