| From 444eb1a699bacfe6d78b1c2234c754734496ef23 Mon Sep 17 00:00:00 2001 |
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
| Date: Mon, 11 Mar 2013 21:43:53 +0100 |
| Subject: [PATCH 4/6] arm/highmem: close race between clear/set pte |
| |
| This patch aims to close the same race in kmap_atomic() / |
| kunmap_atomic() vs switch_kmaps() as on x86. In contrast to x86 the |
| warning has not been seen and the fix has only been compile tested. The |
| pattern is same so the bug should present here as well. |
| |
| Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
| --- |
| arch/arm/mm/highmem.c | 8 ++++++-- |
| 1 file changed, 6 insertions(+), 2 deletions(-) |
| |
| diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c |
| index c8d6d9a..bd41dd8 100644 |
| --- a/arch/arm/mm/highmem.c |
| +++ b/arch/arm/mm/highmem.c |
| @@ -97,6 +97,9 @@ void __kunmap_atomic(void *kvaddr) |
| |
| if (cache_is_vivt()) |
| __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); |
| +#ifdef CONFIG_PREEMPT_RT_FULL |
| + current->kmap_pte[type] = __pte(0); |
| +#endif |
| #ifdef CONFIG_DEBUG_HIGHMEM |
| BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); |
| #else |
| @@ -163,8 +166,9 @@ void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) |
| for (i = 0; i < next_p->kmap_idx; i++) { |
| int idx = i + KM_TYPE_NR * smp_processor_id(); |
| |
| - set_top_pte(__fix_to_virt(FIX_KMAP_BEGIN + idx), |
| - next_p->kmap_pte[i]); |
| + if (!pte_none(next_p->kmap_pte[i])) |
| + set_top_pte(__fix_to_virt(FIX_KMAP_BEGIN + idx), |
| + next_p->kmap_pte[i]); |
| } |
| } |
| #endif |
| -- |
| 1.7.10.4 |
| |