patch-2.3.99-pre7 linux/kernel/exec_domain.c

Next file: linux/kernel/exit.c
Previous file: linux/ipc/util.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/kernel/exec_domain.c linux/kernel/exec_domain.c
@@ -110,9 +110,16 @@
 	if (it) {
 		if (atomic_read(&current->fs->count) != 1) {
 			struct fs_struct *new = copy_fs_struct(current->fs);
-			if (!new)
+			struct fs_struct *old;
+			if (!new) {
+				put_exec_domain(it);
 				return;
-			put_fs_struct(xchg(&current->fs,new));
+			}
+			task_lock(current);
+			old = current->fs;
+			current->fs = new;
+			task_unlock(current);
+			put_fs_struct(old);
 		}
 		/*
 		 * At that point we are guaranteed to be the sole owner of

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)