diff --git a/security/device_cgroup.c b/security/device_cgroup.c index ce14a31b1337..084c8e417564 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -589,9 +589,17 @@ static int propagate_exception(struct dev_cgroup *devcg_root, static inline bool has_children(struct dev_cgroup *devcgroup) { - struct cgroup *cgrp = devcgroup->css.cgroup; + bool ret; - return !list_empty(&cgrp->children); + /* + * FIXME: There may be lingering offline csses and this function + * may return %true when there isn't any userland-visible child + * which is incorrect for our purposes. + */ + rcu_read_lock(); + ret = css_next_child(NULL, &devcgroup->css); + rcu_read_unlock(); + return ret; } /*