Commit 011928c7 authored by Russell King's avatar Russell King

[ARM] Fix page table spinlocking

Patch from Kevin Welton.

The initialisation routines in consistent.c and minicache.c both fail
to put a spinlock in init_mm.page_table_lock when they should do.
parent 9d7a478a
...@@ -321,28 +321,33 @@ static int __init consistent_init(void) ...@@ -321,28 +321,33 @@ static int __init consistent_init(void)
pgd_t *pgd; pgd_t *pgd;
pmd_t *pmd; pmd_t *pmd;
pte_t *pte; pte_t *pte;
int ret = 0;
spin_lock(&init_mm.page_table_lock);
do { do {
pgd = pgd_offset(&init_mm, CONSISTENT_BASE); pgd = pgd_offset(&init_mm, CONSISTENT_BASE);
pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE); pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE);
if (!pmd) { if (!pmd) {
printk(KERN_ERR "consistent_init: out of pmd tables\n"); printk(KERN_ERR "consistent_init: no pmd tables\n");
return -ENOMEM; ret = -ENOMEM;
} break;
if (!pmd_none(*pmd)) {
printk(KERN_ERR "consistent_init: PMD already allocated\n");
return -EINVAL;
} }
WARN_ON(!pmd_none(*pmd));
pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE); pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE);
if (!pte) { if (!pte) {
printk(KERN_ERR "consistent_init: out of pte tables\n"); printk(KERN_ERR "consistent_init: no pte tables\n");
return -ENOMEM; ret = -ENOMEM;
break;
} }
consistent_pte = pte; consistent_pte = pte;
} while (0); } while (0);
return 0; spin_unlock(&init_mm.page_table_lock);
return ret;
} }
core_initcall(consistent_init); core_initcall(consistent_init);
......
...@@ -56,6 +56,8 @@ static int __init minicache_init(void) ...@@ -56,6 +56,8 @@ static int __init minicache_init(void)
pgd_t *pgd; pgd_t *pgd;
pmd_t *pmd; pmd_t *pmd;
spin_lock(&init_mm.page_table_lock);
pgd = pgd_offset_k(minicache_address); pgd = pgd_offset_k(minicache_address);
pmd = pmd_alloc(&init_mm, pgd, minicache_address); pmd = pmd_alloc(&init_mm, pgd, minicache_address);
if (!pmd) if (!pmd)
...@@ -64,6 +66,8 @@ static int __init minicache_init(void) ...@@ -64,6 +66,8 @@ static int __init minicache_init(void)
if (!minicache_pte) if (!minicache_pte)
BUG(); BUG();
spin_unlock(&init_mm.page_table_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment