Commit f6daaf1a authored by Linus Torvalds's avatar Linus Torvalds

Fix incoherent LDT at mmap exit.

We should _not_ update the current LDT if it's not the current
MM that we are tearing down.
parent eb0c5161
...@@ -107,7 +107,8 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -107,7 +107,8 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
void release_segments(struct mm_struct *mm) void release_segments(struct mm_struct *mm)
{ {
if (mm->context.size) { if (mm->context.size) {
clear_LDT(); if (mm == current->active_mm)
clear_LDT();
if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE) if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(mm->context.ldt); vfree(mm->context.ldt);
else else
......
...@@ -132,7 +132,8 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -132,7 +132,8 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
void release_segments(struct mm_struct *mm) void release_segments(struct mm_struct *mm)
{ {
if (mm->context.size) { if (mm->context.size) {
clear_LDT(); if (mm == current->active_mm)
clear_LDT();
if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE) if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
vfree(mm->context.ldt); vfree(mm->context.ldt);
else else
......
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