patch-2.1.70 linux/fs/exec.c

Next file: linux/fs/isofs/inode.c
Previous file: linux/fs/coda/upcall.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.69/linux/fs/exec.c linux/fs/exec.c
@@ -455,6 +455,21 @@
 }
 	
 /*
+ * If make_private_signals() made a copy of the signal table, decrement the
+ * refcount of the original table, and free it if necessary.
+ * We don't do that in make_private_signals() so that we can back off
+ * in flush_old_exec() if an error occurs after calling make_private_signals().
+ */
+
+static inline void release_old_signals(struct signal_struct * oldsig)
+{
+	if (current->sig == oldsig)
+		return;
+	if (atomic_dec_and_test(&oldsig->count))
+		kfree(oldsig);
+}
+
+/*
  * These functions flushes out all traces of the currently running executable
  * so that a new one can be started
  */
@@ -504,6 +519,9 @@
 	 */
 	retval = exec_mmap();
 	if (retval) goto flush_failed;
+
+	/* This is the point of no return */
+	release_old_signals(oldsig);
 
 	if (current->euid == current->uid && current->egid == current->gid)
 		current->dumpable = 1;

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