patch-2.1.23 linux/arch/i386/kernel/ioport.c
Next file: linux/arch/i386/kernel/irq.c
Previous file: linux/arch/i386/kernel/i386_ksyms.c
Back to the patch index
Back to the overall index
- Lines: 58
- Date:
Sun Jan 26 12:07:04 1997
- Orig file:
v2.1.22/linux/arch/i386/kernel/ioport.c
- Orig date:
Wed Oct 9 08:55:17 1996
diff -u --recursive --new-file v2.1.22/linux/arch/i386/kernel/ioport.c linux/arch/i386/kernel/ioport.c
@@ -10,6 +10,9 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
static void set_bitmap(unsigned long *bitmap, short base, short extent, int new_value)
@@ -50,15 +53,19 @@
*/
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
- if (from + num <= from)
- return -EINVAL;
- if (from + num > IO_BITMAP_SIZE*32)
- return -EINVAL;
- if (!suser())
- return -EPERM;
+ int ret = -EINVAL;
+ lock_kernel();
+ if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32))
+ goto out;
+ ret = -EPERM;
+ if (!suser())
+ goto out;
set_bitmap((unsigned long *)current->tss.io_bitmap, from, num, !turn_on);
- return 0;
+ ret = 0;
+out:
+ unlock_kernel();
+ return ret;
}
unsigned int *stack;
@@ -79,11 +86,17 @@
long eflags, long esp, long ss)
{
unsigned int level = ebx;
+ int ret = -EINVAL;
+ lock_kernel();
if (level > 3)
- return -EINVAL;
+ goto out;
+ ret = -EPERM;
if (!suser())
- return -EPERM;
+ goto out;
*(&eflags) = (eflags & 0xffffcfff) | (level << 12);
- return 0;
+ ret = 0;
+out:
+ unlock_kernel();
+ return ret;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov