[PATCH] 2.5.63 tsk->usage count.

Martin Schwidefsky (schwidefsky@de.ibm.com)
Thu, 27 Feb 2003 11:34:28 +0100


Hi Linus,
while debugging a memory leak with task structures on s390
I found something related to it. If copy_process fails for some
reason the task structure created with dup_task_struct has set
p->usage to 2 but only one put_task_struct is done in the error
cleanup code. The attached patch should take care of it.

blue skies,
Martin.

diff -urN linux-2.5/kernel/fork.c linux-2.5-fork/kernel/fork.c
--- linux-2.5/kernel/fork.c Thu Feb 27 11:25:56 2003
+++ linux-2.5-fork/kernel/fork.c Thu Feb 27 10:11:42 2003
@@ -1034,6 +1034,8 @@
atomic_dec(&p->user->processes);
free_uid(p->user);
bad_fork_free:
+ /* dup_task_struct sets p->usage to 2 */
+ atomic_dec(&p->usage);
put_task_struct(p);
goto fork_out;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/