lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 7 Sep 2018 10:54:46 -0700
From:   Tejun Heo <tj@...nel.org>
To:     Dennis Zhou <dennisszhou@...il.com>
Cc:     Jens Axboe <axboe@...nel.dk>, Johannes Weiner <hannes@...xchg.org>,
        Josef Bacik <josef@...icpanda.com>, kernel-team@...com,
        linux-block@...r.kernel.org, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/12] blkcg: remove additional reference to the css

Hello,

On Thu, Sep 06, 2018 at 05:10:42PM -0400, Dennis Zhou wrote:
> +struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
> +					 struct cgroup_subsys *ss)
> +{
> +	struct cgroup_subsys_state *css;
> +
> +	rcu_read_lock();
> +
> +	do {
> +		css = cgroup_css(cgrp, ss);
> +
> +		if (css)
> +			goto out_unlock;
> +		cgrp = cgroup_parent(cgrp);
> +	} while (cgrp);
> +
> +	css = init_css_set.subsys[ss->id];
> +out_unlock:
> +	rcu_read_unlock();

Nothing protects @css here tho.  It can be released before the caller
is done with it.  The caller must ensure that it's holding rcu read
lock to protect the lookup and the subsequent uses.  cgroup_css()
already checks for rcu locking, so if you just drop
rcu_read_lock/unlock(), everything should work fine.

Thanks.

-- 
tejun

Powered by blists - more mailing lists