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