Files
kernel_realme_nemo/kernel
Xiu Jianfeng 70a496919e cgroup: Fix potential overflow issue when checking max_depth
[ Upstream commit 3cc4e13bb1617f6a13e5e6882465984148743cf4 ]

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: 1a926e0bba ("cgroup: implement hierarchy limits")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 339df130db47ae7e89fddce5729b0f0566405d1d)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
2025-12-24 11:22:09 +00:00
..
2021-12-25 18:05:37 +05:30
2025-12-24 11:20:48 +00:00
2021-12-25 18:05:37 +05:30
2025-12-24 11:21:32 +00:00
2021-12-25 18:05:37 +05:30
2022-08-17 15:18:46 +05:30
2021-12-25 18:05:37 +05:30
2021-12-25 18:05:37 +05:30
2025-09-21 09:20:42 +00:00
2023-12-20 15:32:35 +01:00
2023-10-31 18:44:28 +05:30
2020-01-13 19:40:11 +00:00
2020-04-02 16:34:20 +02:00
2021-12-25 18:05:37 +05:30
2024-03-05 23:06:18 +05:30
2025-12-24 11:21:57 +00:00
2021-02-07 14:47:41 +01:00
2020-01-09 10:17:53 +01:00