summaryrefslogtreecommitdiff
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3cc64eb275b1..9da127ff6c4f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1666,10 +1666,14 @@ static int get_tid_list(int index, unsigned int *tids, struct inode *dir)
index -= 2;
read_lock(&tasklist_lock);
- do {
+ /*
+ * The starting point task (leader_task) might be an already
+ * unlinked task, which cannot be used to access the task-list
+ * via next_thread().
+ */
+ if (pid_alive(task)) do {
int tid = task->pid;
- if (!pid_alive(task))
- continue;
+
if (--index >= 0)
continue;
tids[nr_tids] = tid;