patch-2.1.37 linux/arch/i386/kernel/vm86.c

Next file: linux/arch/i386/lib/locks.S
Previous file: linux/arch/i386/kernel/traps.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.36/linux/arch/i386/kernel/vm86.c linux/arch/i386/kernel/vm86.c
@@ -81,8 +81,8 @@
 		printk("vm86: could not access userspace vm86_info\n");
 		do_exit(SIGSEGV);
 	}
-	current->tss.esp0 = current->saved_kernel_stack;
-	current->saved_kernel_stack = 0;
+	current->tss.esp0 = current->tss.saved_esp0;
+	current->tss.saved_esp0 = 0;
 	ret = KVM86->regs32;
 	unlock_kernel();
 	return ret;
@@ -137,7 +137,7 @@
 
 	lock_kernel();
 	tsk = current;
-	if (tsk->saved_kernel_stack)
+	if (tsk->tss.saved_esp0)
 		goto out;
 	tmp  = copy_from_user(&info, v86, VM86_REGS_SIZE1);
 	tmp += copy_from_user(&info.regs.VM86_REGS_PART2, &v86->regs.VM86_REGS_PART2,
@@ -187,7 +187,7 @@
 
 	/* we come here only for functions VM86_ENTER, VM86_ENTER_NO_BYPASS */
 	ret = -EPERM;
-	if (tsk->saved_kernel_stack)
+	if (tsk->tss.saved_esp0)
 		goto out;
 	tmp  = copy_from_user(&info, v86, VM86_REGS_SIZE1);
 	tmp += copy_from_user(&info.regs.VM86_REGS_PART2, &v86->regs.VM86_REGS_PART2,
@@ -247,7 +247,7 @@
  * Save old state, set default return value (%eax) to 0
  */
 	info->regs32->eax = 0;
-	tsk->saved_kernel_stack = tsk->tss.esp0;
+	tsk->tss.saved_esp0 = tsk->tss.esp0;
 	tsk->tss.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
 
 	tsk->tss.screen_bitmap = info->screen_bitmap;
@@ -601,11 +601,17 @@
 static inline int task_valid(struct task_struct *tsk)
 {
 	struct task_struct *p;
+	int ret = 0;
 
+	read_lock(&tasklist_lock);
 	for_each_task(p) {
-		if ((p == tsk) && (p->sig)) return 1;
+		if ((p == tsk) && (p->sig)) {
+			ret = 1;
+			break;
+		}
 	}
-	return 0;
+	read_unlock(&tasklist_lock);
+	return ret;
 }
 
 static inline void handle_irq_zombies(void)

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