Commit 4c47acd8 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Ingo Molnar

sched/core: Fix buffer overflow in cgroup2 property cpu.max

Add limit into sscanf format string for on-stack buffer.
Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 0d593634 ("sched: Implement interface for cgroup unified hierarchy")
Link: https://lkml.kernel.org/r/155189230232.2620.13120481613524200065.stgit@buzzSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a23314e9
...@@ -6943,7 +6943,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf, ...@@ -6943,7 +6943,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf,
{ {
char tok[21]; /* U64_MAX */ char tok[21]; /* U64_MAX */
if (!sscanf(buf, "%s %llu", tok, periodp)) if (sscanf(buf, "%20s %llu", tok, periodp) < 1)
return -EINVAL; return -EINVAL;
*periodp *= NSEC_PER_USEC; *periodp *= NSEC_PER_USEC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment