patch-2.1.23 linux/arch/i386/kernel/ldt.c

Next file: linux/arch/i386/kernel/process.c
Previous file: linux/arch/i386/kernel/irq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/arch/i386/kernel/ldt.c linux/arch/i386/kernel/ldt.c
@@ -8,6 +8,8 @@
 #include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
 #include <linux/vmalloc.h>
 
 #include <asm/uaccess.h>
@@ -117,11 +119,17 @@
 
 asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
 {
+	int ret;
+
+	lock_kernel();
 	if (func == 0)
-		return read_ldt(ptr, bytecount);
-	if (func == 1)
-		return write_ldt(ptr, bytecount, 1);
-	if (func == 0x11)
-		return write_ldt(ptr, bytecount, 0);
-	return -ENOSYS;
+		ret = read_ldt(ptr, bytecount);
+	else if (func == 1)
+		ret = write_ldt(ptr, bytecount, 1);
+	else  if (func == 0x11)
+		ret = write_ldt(ptr, bytecount, 0);
+	else
+		ret = -ENOSYS;
+	unlock_kernel();
+	return ret;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov