[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110720190036.GB21753@redhat.com>
Date: Wed, 20 Jul 2011 21:00:36 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Vasiliy Kulikov <segoon@...nwall.com>
Cc: Balbir Singh <bsingharora@...il.com>,
Jerome Marchand <jmarchan@...hat.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] taskstats: add_del_listener() should ignore !valid
listener's
When send_cpu_listeners() finds the orphaned listener it marks
it as !valid and drops listeners->sem. Before it takes this sem
for wrinting, s->pid can be reused and add_del_listener() can
wrongly try to re-use this entry.
Change add_del_listener() to check ->valid = T.
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
kernel/taskstats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- ts/kernel/taskstats.c~2_ck_valid 2011-07-20 20:18:19.000000000 +0200
+++ ts/kernel/taskstats.c 2011-07-20 20:18:47.000000000 +0200
@@ -304,7 +304,7 @@ static int add_del_listener(pid_t pid, c
listeners = &per_cpu(listener_array, cpu);
down_write(&listeners->sem);
list_for_each_entry(s2, &listeners->list, list) {
- if (s2->pid == pid)
+ if (s2->pid == pid && s2->valid)
goto exists;
}
list_add(&s->list, &listeners->list);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists