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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux