From f912696ab330bf539231d1f8032320f2a08b850f Mon Sep 17 00:00:00 2001
From: Bart Oldeman <bartoldeman@users.sourceforge.net>
Date: Sun, 6 Nov 2005 12:54:07 +1300
Subject: [PATCH] reset tss->io_bitmap_owner in sys_ioperm()

my patch "x86: initialise tss->io_bitmap_owner to something" (commit ID
d5cd4aadd3d220afac8e3e6d922e333592551f7d) introduced a problem with a
program (DOSEMU) that called ioperm after already doing some port i/o.

The problem is that a process switch return causes tss->io_bitmap_base
to be set to IO_BITMAP_OFFSET so that the fault (that *really* sets the
io bitmap) never triggers.

This fixes that regression.

Signed-off-by: Bart Oldeman <bartoldeman@users.sourceforge.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 arch/i386/kernel/ioport.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'arch')

diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c
index f2b37654777..b59a34dbe26 100644
--- a/arch/i386/kernel/ioport.c
+++ b/arch/i386/kernel/ioport.c
@@ -108,8 +108,11 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 	/*
 	 * Sets the lazy trigger so that the next I/O operation will
 	 * reload the correct bitmap.
+	 * Reset the owner so that a process switch will not set
+	 * tss->io_bitmap_base to IO_BITMAP_OFFSET.
 	 */
 	tss->io_bitmap_base = INVALID_IO_BITMAP_OFFSET_LAZY;
+	tss->io_bitmap_owner = NULL;
 
 	put_cpu();
 
-- 
cgit v1.2.3-18-g5258