diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2019-06-30 03:26:38 -0700 |
|---|---|---|
| committer | Linux Build Service Account <lnxbuild@localhost> | 2019-06-30 03:26:38 -0700 |
| commit | f6f18bf58a688e45e149708a00659bd1010ef94c (patch) | |
| tree | aea1549c4c8f28ad359a92b7702481b2cb369d20 /kernel/sched/core.c | |
| parent | c9d92a953ba0dffba643376ec463754a88db107a (diff) | |
| parent | 17c66e9e49a181498ae3c75809c98fdbe630de28 (diff) | |
Merge 17c66e9e49a181498ae3c75809c98fdbe630de28 on remote branch
Change-Id: I49238aefe09bba152a8000c046959157c328f183
Diffstat (limited to 'kernel/sched/core.c')
| -rw-r--r-- | kernel/sched/core.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 56c55e49fe29..cccb3564410b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9380,6 +9380,8 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) static int cpu_shares_write_u64(struct cgroup_subsys_state *css, struct cftype *cftype, u64 shareval) { + if (shareval > scale_load_down(ULONG_MAX)) + shareval = MAX_SHARES; return sched_group_set_shares(css_tg(css), scale_load(shareval)); } @@ -9479,8 +9481,10 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) period = ktime_to_ns(tg->cfs_bandwidth.period); if (cfs_quota_us < 0) quota = RUNTIME_INF; - else + else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC) quota = (u64)cfs_quota_us * NSEC_PER_USEC; + else + return -EINVAL; return tg_set_cfs_bandwidth(tg, period, quota); } @@ -9502,6 +9506,9 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) { u64 quota, period; + if ((u64)cfs_period_us > U64_MAX / NSEC_PER_USEC) + return -EINVAL; + period = (u64)cfs_period_us * NSEC_PER_USEC; quota = tg->cfs_bandwidth.quota; |
