[PATCH] cgroup: missing rcu read lock around task_css_set

From: Sasha Levin
Date: Sat Mar 01 2014 - 22:00:37 EST


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@xxxxxxxxxx>
---
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

--
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/