lkml.org 
[lkml]   [2003]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ioperm() fix
Properly initialize the IO bitmap in the TSS on the first ioperm() call.

--
Brian Gerst
diff -urN linux-2.5.64-bk5/arch/i386/kernel/ioport.c linux/arch/i386/kernel/ioport.c
--- linux-2.5.64-bk5/arch/i386/kernel/ioport.c 2003-02-24 14:59:03.000000000 -0500
+++ linux/arch/i386/kernel/ioport.c 2003-03-14 10:19:48.000000000 -0500
@@ -84,15 +84,17 @@
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 ...
*/
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();
out:
return ret;
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.021 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site