Commit d0682bc8 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] Fix ioperm bitmap

This makes sure that the ioperm bitmap in the TSS is correctly set up
during the first ioperm() call.  Without this the TSS bitmap contains
random garbage until the next context switch.
parent e5f78c74
...@@ -84,15 +84,17 @@ asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on) ...@@ -84,15 +84,17 @@ asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
t->ts_io_bitmap = bitmap; t->ts_io_bitmap = bitmap;
} }
tss = init_tss + get_cpu();
if (bitmap)
tss->bitmap = IO_BITMAP_OFFSET; /* Activate it in the TSS */
/* /*
* do it in the per-thread copy and in the TSS ... * do it in the per-thread copy and in the TSS ...
*/ */
set_bitmap(t->ts_io_bitmap, from, num, !turn_on); set_bitmap(t->ts_io_bitmap, from, num, !turn_on);
set_bitmap(tss->io_bitmap, from, num, !turn_on); tss = init_tss + get_cpu();
if (tss->bitmap == IO_BITMAP_OFFSET) { /* already active? */
set_bitmap(tss->io_bitmap, from, num, !turn_on);
} else {
memcpy(tss->io_bitmap, t->ts_io_bitmap, IO_BITMAP_BYTES);
tss->bitmap = IO_BITMAP_OFFSET; /* Activate it in the TSS */
}
put_cpu(); put_cpu();
out: out:
return ret; return ret;
......
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