From 27c8c87a18d985171a518b2e8219a71f6076b7ab Mon Sep 17 00:00:00 2001 From: Hui Tang Date: Tue, 20 Jun 2023 20:49:28 +0800 Subject: [PATCH] sched: Adjust few parameters range for smart grid hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7EEF3 CVE: NA ------------------------------- Adjust few parameters range for smart grid. Fixes: 713cfd2684fa ("sched: Introduce smart grid scheduling strategy for cfs") Signed-off-by: Hui Tang Reviewed-by: Zhang Qiao Signed-off-by: Zhang Changzhong --- kernel/sched/core.c | 2 +- kernel/sysctl.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7eea1f809fbe..c7016a4acb56 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7026,7 +7026,7 @@ int tg_set_affinity_period(struct task_group *tg, u64 period_ms) if (unlikely(!tg->auto_affinity)) return -EPERM; - if (period_ms > U64_MAX / NSEC_PER_MSEC) + if (!period_ms || period_ms > U64_MAX / NSEC_PER_MSEC) return -EINVAL; raw_spin_lock_irq(&tg->auto_affinity->lock); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 592440a2d5db..c7064f67f4a5 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -139,7 +139,7 @@ static int one_thousand = 1000; #ifdef CONFIG_PRINTK static int ten_thousand = 10000; #endif -#ifdef CONFIG_QOS_SCHED +#if defined(CONFIG_QOS_SCHED) || defined(CONFIG_QOS_SCHED_SMART_GRID) static int hundred_thousand = 100000; #endif #ifdef CONFIG_PERF_EVENTS @@ -1343,7 +1343,9 @@ static struct ctl_table kern_table[] = { .data = &sysctl_affinity_adjust_delay_ms, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, + .extra2 = &hundred_thousand, }, #endif { } -- GitLab