* [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max
@ 2019-03-06 17:11 Konstantin Khlebnikov
2019-03-06 18:07 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2019-03-06 17:11 UTC (permalink / raw)
To: Tejun Heo, Peter Zijlstra (Intel), linux-kernel
Cc: cgroups, Li Zefan, Ingo Molnar, Johannes Weiner
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max
2019-03-06 17:11 [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max Konstantin Khlebnikov
@ 2019-03-06 18:07 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2019-03-06 18:07 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: Peter Zijlstra (Intel), linux-kernel, cgroups, Li Zefan,
Ingo Molnar, Johannes Weiner
On Wed, Mar 06, 2019 at 08:11:42PM +0300, Konstantin Khlebnikov wrote:
> 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>
Acked-by: Tejun Heo <tj@kernel.org>
Thanks and I look forward to the sscanf improvements. That'd be
really nice to have.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-06 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-06 17:11 [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max Konstantin Khlebnikov
2019-03-06 18:07 ` Tejun Heo
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).