[PATCH] x86/ldt: Initialize the context lock for init_mm

From: Sebastian Andrzej Siewior
Date: Mon Jul 01 2019 - 13:33:58 EST


The mutex mm->context->lock for init_mm is not initialized for init_mm.
This wasn't a problem because it remained unused. This changed however
since commit
4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")

Initialize the mutex for init_mm.

Fixes: 4fc19708b165c ("x86/alternatives: Initialize temporary mm for patching")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---

The rwsem `ldt_usr_sem' is also not initialized for init_mm. No idea if
we want this.

arch/x86/include/asm/mmu.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
index 5ff3e8af2c205..e78c7db878018 100644
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -59,6 +59,7 @@ typedef struct {
#define INIT_MM_CONTEXT(mm) \
.context = { \
.ctx_id = 1, \
+ .lock = __MUTEX_INITIALIZER(mm.context.lock), \
}

void leave_mm(int cpu);
--
2.20.1