]> git.baikalelectronics.ru Git - kernel.git/commit
sched/debug: Fix memory corruption caused by multiple small reads of flags
authorColin Ian King <colin.king@canonical.com>
Thu, 29 Oct 2020 15:11:03 +0000 (15:11 +0000)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 10 Nov 2020 17:38:49 +0000 (18:38 +0100)
commitf3c6b7a9fed2f7bb9b059e9d00982d4a21502bb3
treee3a18d575d44955453501aa05b0dee98184162c5
parentcb2ec71b6f044cea50fe0743dfeb847f24a98d45
sched/debug: Fix memory corruption caused by multiple small reads of flags

Reading /proc/sys/kernel/sched_domain/cpu*/domain0/flags mutliple times
with small reads causes oopses with slub corruption issues because the kfree is
free'ing an offset from a previous allocation. Fix this by adding in a new
pointer 'buf' for the allocation and kfree and use the temporary pointer tmp
to handle memory copies of the buf offsets.

Fixes: acbddcc11e19 ("sched/debug: Output SD flag names rather than their values")
Reported-by: Jeff Bastian <jbastian@redhat.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20201029151103.373410-1-colin.king@canonical.com
kernel/sched/debug.c