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)
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
int ret = 0;
spin_lock(&init_mm.page_table_lock);
do {
pgd = pgd_offset(&init_mm, CONSISTENT_BASE);
pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE);
if (!pmd) {
printk(KERN_ERR "consistent_init: out of pmd tables\n");
return -ENOMEM;
}
if (!pmd_none(*pmd)) {
printk(KERN_ERR "consistent_init: PMD already allocated\n");
return -EINVAL;
printk(KERN_ERR "consistent_init: no pmd tables\n");
ret = -ENOMEM;
break;
}
WARN_ON(!pmd_none(*pmd));
pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE);
if (!pte) {
printk(KERN_ERR "consistent_init: out of pte tables\n");
return -ENOMEM;
printk(KERN_ERR "consistent_init: no pte tables\n");
ret = -ENOMEM;
break;
}
consistent_pte = pte;
} while (0);
return 0;
spin_unlock(&init_mm.page_table_lock);
return ret;
}
core_initcall(consistent_init);
......
......@@ -56,6 +56,8 @@ static int __init minicache_init(void)
pgd_t *pgd;
pmd_t *pmd;
spin_lock(&init_mm.page_table_lock);
pgd = pgd_offset_k(minicache_address);
pmd = pmd_alloc(&init_mm, pgd, minicache_address);
if (!pmd)
......@@ -64,6 +66,8 @@ static int __init minicache_init(void)
if (!minicache_pte)
BUG();
spin_unlock(&init_mm.page_table_lock);
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