mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ioperm() fix
@ 2003-03-14 20:09 Brian Gerst
  0 siblings, 0 replies; only message in thread
From: Brian Gerst @ 2003-03-14 20:09 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 93 bytes --]

Properly initialize the IO bitmap in the TSS on the first ioperm() call.

--
				Brian Gerst

[-- Attachment #2: iobitmap-1 --]
[-- Type: text/plain, Size: 890 bytes --]

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-14 19:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-14 20:09 [PATCH] ioperm() fix Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®