sched/core: fix buffer overflow in cgroup2 property cpu.max
PATCH 1/1 sched/core: fix buffer overflow in cgroup2 property cpu.max
Add limit into sscanf format string for on-stack buffer.
Fixes 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy")
Signed-off-by Konstantin Khlebnikov <[email protected]>
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -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 ;
Quoted 4 lines · Konstantin Khlebnikov
Add limit into sscanf format string for on-stack buffer.
Fixes 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy")Signed-off-by Konstantin Khlebnikov <[email protected]>
Acked-by Tejun Heo <[email protected]>
Thanks and I look forward to the sscanf improvements. That'd be really nice to have.
Signature · 1 line
tejun
tip-bot for Konstantin Khlebnikov
merge bot[tip:sched/urgent] sched/core: Fix buffer overflow in cgroup2 property cpu.max
In reply to Konstantin Khlebnikovsched/core: Fix buffer overflow in cgroup2 property cpu.max
Commit-ID: 5105fa52df1f249f996308188dd1e85c3ae62de5 Gitweb: https://git.kernel.org/tip/5105fa52df1f249f996308188dd1e85c3ae62de5 Author: Konstantin Khlebnikov <[email protected]> AuthorDate: Wed, 6 Mar 2019 20:11:42 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 9 Mar 2019 14:03:51 +0100
sched/core: Fix buffer overflow in cgroup2 property cpu.max
Add limit into sscanf format string for on-stack buffer.
Signed-off-by Konstantin Khlebnikov <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Acked-by Tejun Heo <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Li Zefan <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy")
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -6943,7 +6943,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 ;
tip-bot for Konstantin Khlebnikov
merge bot[tip:sched/urgent] sched/core: Fix buffer overflow in cgroup2 property cpu.max
In reply to Konstantin Khlebnikovsched/core: Fix buffer overflow in cgroup2 property cpu.max
Commit-ID: 4c47acd824aaaa8fc6dc519fb4e08d1522105b7a Gitweb: https://git.kernel.org/tip/4c47acd824aaaa8fc6dc519fb4e08d1522105b7a Author: Konstantin Khlebnikov <[email protected]> AuthorDate: Wed, 6 Mar 2019 20:11:42 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 19 Mar 2019 12:06:15 +0100
sched/core: Fix buffer overflow in cgroup2 property cpu.max
Add limit into sscanf format string for on-stack buffer.
Signed-off-by Konstantin Khlebnikov <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Acked-by Tejun Heo <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Li Zefan <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 0d5936344f30 ("sched: Implement interface for cgroup unified hierarchy")
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -6943,7 +6943,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 ;