cgroups.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
       [not found] ` <1393729211-937-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Sasha Levin @ 2014-03-02  3:00 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan-hv44wF8Li93QT0dZR+AlfA
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, 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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 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:48 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
     [not found] ` <1393729211-937-1-git-send-email-sasha.levin-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-03-03 22:33   ` Tejun Heo
     [not found]     ` <20140303223327.GB26523-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2014-03-03 22:43       ` Sasha Levin
     [not found]         ` <5315057F.3030602-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-03-03 22:45           ` Tejun Heo
2014-03-03 22:48             ` Sasha Levin
     [not found]             ` <20140303224505.GE26523-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2014-03-03 23:00               ` Sasha Levin
     [not found]                 ` <53150989.70307-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-03-04 17:20                   ` Sasha Levin
     [not found]                     ` <53160B6D.8020501-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-03-04 19:47                       ` Tejun Heo
     [not found]                         ` <20140304194741.GA2204-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-03-05  0:57                           ` Li Zefan
     [not found]                             ` <53167662.5000801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-03-27 15:35                               ` Sasha Levin
     [not found]                                 ` <5334452D.4080200-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
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).