[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zw2r1v5X33rtF7kG@slm.duckdns.org>
Date: Mon, 14 Oct 2024 13:40:06 -1000
From: Tejun Heo <tj@...nel.org>
To: Xiu Jianfeng <xiujianfeng@...weicloud.com>
Cc: lizefan.x@...edance.com, hannes@...xchg.org, mkoutny@...e.com,
roman.gushchin@...ux.dev, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, wangweiyang2@...wei.com
Subject: Re: [PATCH] cgroup: Fix potential overflow issue when checking
max_depth
On Sat, Oct 12, 2024 at 07:22:46AM +0000, Xiu Jianfeng wrote:
> From: Xiu Jianfeng <xiujianfeng@...wei.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@...wei.com>
Applied to cgroup/for-6.12-fixes.
Thanks.
--
tejun
Powered by blists - more mailing lists