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,6 +107,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -107,6 +107,7 @@ 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) {
if (mm == current->active_mm)
clear_LDT(); 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);
......
...@@ -132,6 +132,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -132,6 +132,7 @@ 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) {
if (mm == current->active_mm)
clear_LDT(); 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);
......
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