patch-2.1.23 linux/arch/m68k/kernel/process.c

Next file: linux/arch/m68k/kernel/ptrace.c
Previous file: linux/arch/m68k/kernel/m68k_ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/arch/m68k/kernel/process.c linux/arch/m68k/kernel/process.c
@@ -14,6 +14,8 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
 #include <linux/ptrace.h>
@@ -34,13 +36,20 @@
  */
 asmlinkage int sys_idle(void)
 {
+	int ret = -EPERM;
+
+	lock_kernel();
 	if (current->pid != 0)
-		return -EPERM;
+		goto out;
 
 	/* endless idle loop with no priority at all */
 	current->counter = -100;
 	for (;;)
 		schedule();
+	ret = 0;
+out:
+	unlock_kernel();
+	return ret;
 }
 
 void hard_reset_now(void)
@@ -86,20 +95,29 @@
 
 asmlinkage int m68k_fork(struct pt_regs *regs)
 {
-	return do_fork(SIGCHLD, rdusp(), regs);
+	int ret;
+
+	lock_kernel();
+	ret = do_fork(SIGCHLD, rdusp(), regs);
+	unlock_kernel();
+	return ret;
 }
 
 asmlinkage int m68k_clone(struct pt_regs *regs)
 {
 	unsigned long clone_flags;
 	unsigned long newsp;
+	int ret;
 
+	lock_kernel();
 	/* syscall2 puts clone_flags in d1 and usp in d2 */
 	clone_flags = regs->d1;
 	newsp = regs->d2;
 	if (!newsp)
 	  newsp  = rdusp();
-	return do_fork(clone_flags, newsp, regs);
+	ret = do_fork(clone_flags, newsp, regs);
+	unlock_kernel();
+	return ret;
 }
 
 void release_thread(struct task_struct *dead_task)
@@ -224,10 +242,13 @@
 	char * filename;
 	struct pt_regs *regs = (struct pt_regs *) &name;
 
+	lock_kernel();
 	error = getname(name, &filename);
 	if (error)
-		return error;
+		goto out;
 	error = do_execve(filename, argv, envp, regs);
 	putname(filename);
+out:
+	unlock_kernel();
 	return error;
 }

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