From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Tejun Heo <tj@kernel.org>,
"Peter Zijlstra \(Intel\)" <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Cc: cgroups@vger.kernel.org, Li Zefan <lizefan@huawei.com>,
Ingo Molnar <mingo@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max
Date: Wed, 06 Mar 2019 20:11:42 +0300 [thread overview]
Message-ID: <155189230232.2620.13120481613524200065.stgit@buzz> (raw)
Add limit into sscanf format string for on-stack buffer.
Fixes: 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy")
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 43f44539b88f..3971bc62521d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6968,7 +6968,7 @@ static int __maybe_unused cpu_period_quota_parse(char *buf,
{
char tok[21]; /* U64_MAX */
- if (!sscanf(buf, "%s %llu", tok, periodp))
+ if (sscanf(buf, "%20s %llu", tok, periodp) < 1)
return -EINVAL;
*periodp *= NSEC_PER_USEC;
next reply other threads:[~2019-03-06 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 17:11 Konstantin Khlebnikov [this message]
2019-03-06 18:07 ` [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max Tejun Heo
2019-03-09 14:36 ` [tip:sched/urgent] sched/core: Fix " tip-bot for Konstantin Khlebnikov
2019-03-19 11:11 ` tip-bot for Konstantin Khlebnikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=155189230232.2620.13120481613524200065.stgit@buzz \
--to=khlebnikov@yandex-team.ru \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).