From 172edfcb3102374aef9b7730aba42865fee1b644 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 12 May 2003 09:12:34 -0700 Subject: [PATCH] de_thread memory corruption fix From: Manfred Spraul de_thread calls list_del(¤t->tasks), but current->tasks was never added to the task list. The structure contains stale values from the parent. switch_exec_pid() transforms a normal thread to a thread group leader. Thread group leaders are included in the init_task.tasks linked list, non-leaders are not in that list. The patch adds the new thread group leader to the linked list, otherwise de_thread corrupts the task list. --- kernel/pid.c | 1 + 1 file changed, 1 insertion(+) (limited to 'kernel') diff --git a/kernel/pid.c b/kernel/pid.c index f5afb3137e74..00413e3967b9 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -252,6 +252,7 @@ void switch_exec_pids(task_t *leader, task_t *thread) attach_pid(thread, PIDTYPE_TGID, thread->tgid); attach_pid(thread, PIDTYPE_PGID, thread->pgrp); attach_pid(thread, PIDTYPE_SID, thread->session); + list_add_tail(&thread->tasks, &init_task.tasks); attach_pid(leader, PIDTYPE_PID, leader->pid); attach_pid(leader, PIDTYPE_TGID, leader->tgid); -- cgit v1.2.3