mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Xiu Jianfeng <xiujianfeng@huaweicloud.com>
Cc: lizefan.x@bytedance.com, hannes@cmpxchg.org, mkoutny@suse.com,
	roman.gushchin@linux.dev, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, wangweiyang2@huawei.com
Subject: Re: [PATCH] cgroup: Fix potential overflow issue when checking max_depth
Date: Mon, 14 Oct 2024 13:40:06 -1000	[thread overview]
Message-ID: <Zw2r1v5X33rtF7kG@slm.duckdns.org> (raw)
In-Reply-To: <20241012072246.158766-1-xiujianfeng@huaweicloud.com>

On Sat, Oct 12, 2024 at 07:22:46AM +0000, Xiu Jianfeng wrote:
> From: Xiu Jianfeng <xiujianfeng@huawei.com>
> 
> cgroup.max.depth is the maximum allowed descent depth below the current
> cgroup. If the actual descent depth is equal or larger, an attempt to
> create a new child cgroup will fail. However due to the cgroup->max_depth
> is of int type and having the default value INT_MAX, the condition
> 'level > cgroup->max_depth' will never be satisfied, and it will cause
> an overflow of the level after it reaches to INT_MAX.
> 
> Fix it by starting the level from 0 and using '>=' instead.
> 
> It's worth mentioning that this issue is unlikely to occur in reality,
> as it's impossible to have a depth of INT_MAX hierarchy, but should be
> be avoided logically.
> 
> Fixes: 1a926e0bbab8 ("cgroup: implement hierarchy limits")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>

Applied to cgroup/for-6.12-fixes.

Thanks.

-- 
tejun

      parent reply	other threads:[~2024-10-14 23:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12  7:22 Xiu Jianfeng
2024-10-14 13:37 ` Michal Koutný
2024-10-14 14:17   ` Xiu Jianfeng
2024-10-14 23:40 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zw2r1v5X33rtF7kG@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mkoutny@suse.com \
    --cc=roman.gushchin@linux.dev \
    --cc=wangweiyang2@huawei.com \
    --cc=xiujianfeng@huaweicloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®