linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: missing rcu read lock around task_css_set
@ 2014-03-02  3:00 Sasha Levin
  2014-03-03 22:33 ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2014-03-02  3:00 UTC (permalink / raw)
  To: tj, lizefan; +Cc: containers, cgroups, linux-kernel, Sasha Levin

rcu read lock should be held when calling and working with task_css_set.

This patch also fixes a related lockdep warning.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/cgroup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 8f4ddbe..f638ad6 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4361,6 +4361,7 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
 	}
 
 	/* Reassign the task to the init_css_set. */
+	rcu_read_lock();
 	cset = task_css_set(tsk);
 	RCU_INIT_POINTER(tsk->cgroups, &init_css_set);
 
@@ -4378,6 +4379,7 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
 
 	if (put_cset)
 		put_css_set(cset, true);
+	rcu_read_unlock();
 }
 
 static void check_for_release(struct cgroup *cgrp)
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-28  2:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-02  3:00 [PATCH] cgroup: missing rcu read lock around task_css_set Sasha Levin
2014-03-03 22:33 ` Tejun Heo
2014-03-03 22:43   ` Sasha Levin
2014-03-03 22:45     ` Tejun Heo
2014-03-03 22:48       ` Sasha Levin
2014-03-03 23:00       ` Sasha Levin
2014-03-04 17:20         ` Sasha Levin
2014-03-04 19:47           ` Tejun Heo
2014-03-05  0:57             ` Li Zefan
2014-03-27 15:35               ` Sasha Levin
2014-03-28  2:48                 ` Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).