Re: [RFC][PATCH] ps command race fix take2 [4/4] proc_pid_readdir

From: KAMEZAWA Hiroyuki
Date: Tue Aug 22 2006 - 05:32:52 EST


sorry, this rcu_read_lock() should be inserted.

-Kame

fs/proc/base.c | 2 ++
1 files changed, 2 insertions(+)

Index: linux-2.6.18-rc4/fs/proc/base.c
===================================================================
--- linux-2.6.18-rc4.orig/fs/proc/base.c
+++ linux-2.6.18-rc4/fs/proc/base.c
@@ -2240,12 +2240,14 @@ retry:
* insertion of token should be done just before not-stale task.
*/
if (task) {
+ rcu_read_lock();
pos = first_alive_task(task);
if (pos != task) { /* task is not alive */
if (pos)
get_task_struct(pos);
put_task_struct(task);
}
+ rcu_read_unlock();
if (pos) { /* remember here for next access */
/* token->token turns to be 1 */
insert_list_token_rcu(token, &pos->tasks);

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