From c4683c545a582d38c92461b75ba7b05fac63d6a9 Mon Sep 17 00:00:00 2001 From: zhangguangzhi Date: Thu, 17 Jul 2025 22:40:50 +0800 Subject: [PATCH] cgroup/cpu: fix missing validation for burst exceeding quota Previous cpu burst patch partially missed the validation logic when setting burst values. This caused an issue where: - When quota is set to a normal value (e.g., 50000 us) - Attempting to set burst to a value larger than quota (e.g., 60000 us) Expected behavior: Should fail with EINVAL error Actual behavior: Invalid burst value was incorrectly accepted This patch adds the missing validation check to ensure burst values cannot exceed corresponding quota limits. Fixes: c62d6b571d573 ("ock: sync codes to ock 5.4.119-20.0009.21") Signed-off-by: zhangguangzhi Signed-off-by: zhaolichang <943677312@qq.com> --- kernel/sched/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index eb40b0d27bbe..c8a6c7e191ba 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8870,10 +8870,8 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota, if (quota != RUNTIME_INF && quota > max_cfs_runtime) return -EINVAL; - /* - * Bound burst to defend burst against overflow during bandwidth shift. - */ - if (burst > max_cfs_runtime) + if (quota != RUNTIME_INF && (burst > quota || + burst + quota > max_cfs_runtime)) return -EINVAL; /* -- Gitee