patch-2.1.96 linux/kernel/fork.c

Next file: linux/kernel/kmod.c
Previous file: linux/init/main.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.95/linux/kernel/fork.c linux/kernel/fork.c
@@ -300,13 +300,14 @@
 void mmput(struct mm_struct *mm)
 {
 	if (!--mm->count) {
+		release_segments(mm);
 		exit_mmap(mm);
 		free_page_tables(mm);
 		kmem_cache_free(mm_cachep, mm);
 	}
 }
 
-static inline int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
+static inline int copy_mm(int nr, unsigned long clone_flags, struct task_struct * tsk)
 {
 	struct mm_struct * mm;
 	int retval;
@@ -326,6 +327,7 @@
 	tsk->min_flt = tsk->maj_flt = 0;
 	tsk->cmin_flt = tsk->cmaj_flt = 0;
 	tsk->nswap = tsk->cnswap = 0;
+	copy_segments(nr, tsk, mm);
 	retval = new_page_tables(tsk);
 	if (retval)
 		goto free_mm;
@@ -542,7 +544,7 @@
 		goto bad_fork_cleanup_files;
 	if (copy_sighand(clone_flags, p))
 		goto bad_fork_cleanup_fs;
-	if (copy_mm(clone_flags, p))
+	if (copy_mm(nr, clone_flags, p))
 		goto bad_fork_cleanup_sighand;
 	error = copy_thread(nr, clone_flags, usp, p, regs);
 	if (error)

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