From 3d3ecd42f94bc059d61b7c8feb745f80e5cc8357 Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Thu, 22 Apr 2010 17:29:24 +0800 Subject: [PATCH] --- yaml --- r: 190679 b: refs/heads/master c: 9a9686b634acc5cb6b7c601c171ae64af0318a24 h: refs/heads/master i: 190677: 830f6141bccdfb6f9a4ce5804b72cae4439c567f 190675: 27bcef033a2deda8c1d20e0c22d728415ee7857f 190671: 969309b1e4184b056aa496ef80077abcd613ddd4 v: v3 --- [refs] | 2 +- trunk/kernel/cgroup.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 75cb6368d62e..67b20e9dfd88 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e35ec2d2c1fc45dd3e46dde74bb0c4c4366125bf +refs/heads/master: 9a9686b634acc5cb6b7c601c171ae64af0318a24 diff --git a/trunk/kernel/cgroup.c b/trunk/kernel/cgroup.c index e2769e13980c..4ca928db890c 100644 --- a/trunk/kernel/cgroup.c +++ b/trunk/kernel/cgroup.c @@ -1646,7 +1646,9 @@ static inline struct cftype *__d_cft(struct dentry *dentry) int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) { char *start; - struct dentry *dentry = rcu_dereference(cgrp->dentry); + struct dentry *dentry = rcu_dereference_check(cgrp->dentry, + rcu_read_lock_held() || + cgroup_lock_is_held()); if (!dentry || cgrp == dummytop) { /* @@ -1662,13 +1664,17 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) *--start = '\0'; for (;;) { int len = dentry->d_name.len; + if ((start -= len) < buf) return -ENAMETOOLONG; - memcpy(start, cgrp->dentry->d_name.name, len); + memcpy(start, dentry->d_name.name, len); cgrp = cgrp->parent; if (!cgrp) break; - dentry = rcu_dereference(cgrp->dentry); + + dentry = rcu_dereference_check(cgrp->dentry, + rcu_read_lock_held() || + cgroup_lock_is_held()); if (!cgrp->parent) continue; if (--start < buf)