All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/core: fix buffer overflow in cgroup2 property cpu.max
@ 2019-03-06 17:11 ` Konstantin Khlebnikov
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2019-03-19 11:12 UTC | newest]

Thread overview: 5+ 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 17:11 ` Konstantin Khlebnikov
2019-03-06 18:07 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.