[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <vlgk7nn72odfg4xk34yagrvtwlqb3qkq24wbsrvjctd4upa5vm@7jg2iy7pkqof>
Date: Fri, 18 Jul 2025 14:55:21 +0200
From: Michal Koutný <mkoutny@...e.com>
To: Zijiang Huang <huangzjsmile@...il.com>
Cc: tj@...nel.org, hannes@...xchg.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijiang Huang <kerayhuang@...cent.com>,
Hao Peng <flyingpeng@...cent.com>
Subject: Re: [PATCH 2/2] cgroup: Fix reference count leak when cft->open is
NULL
On Fri, Jul 18, 2025 at 07:54:09PM +0800, Zijiang Huang <huangzjsmile@...il.com> wrote:
> @@ -4134,8 +4134,10 @@ static int cgroup_file_open(struct kernfs_open_file *of)
> get_cgroup_ns(ctx->ns);
> of->priv = ctx;
>
> - if (!cft->open)
> + if (!cft->open) {
> + get_cgroup_ns(ctx->ns);
> return 0;
> + }
>
> ret = cft->open(of);
> if (ret) {
1) You wanted to call put_cgroup_ns() instead of get_cgroup_ns()
2) The refernce needs to be kept during the whole lifetime of
cgroup_file_ctx, this return path still leads to a valid ctx, so it's
released in cgroup_file_release().
Or could you decribe more how could a release be missed?
Thanks,
Michal
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists