]> git.baikalelectronics.ru Git - kernel.git/commit
sched/psi: Fix OOB write when writing 0 bytes to PSI files
authorSuren Baghdasaryan <surenb@google.com>
Mon, 3 Feb 2020 21:22:16 +0000 (13:22 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 11 Feb 2020 12:00:02 +0000 (13:00 +0100)
commite2b03e5701cc866aef913e64ac71f51ca300f4af
tree115c2c04cbf09859e5e81c0c13aafe7959ffa617
parentea34d100c84841e9f739b4b061d854c2af9e8b1d
sched/psi: Fix OOB write when writing 0 bytes to PSI files

Issuing write() with count parameter set to 0 on any file under
/proc/pressure/ will cause an OOB write because of the access to
buf[buf_size-1] when NUL-termination is performed. Fix this by checking
for buf_size to be non-zero.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Link: https://lkml.kernel.org/r/20200203212216.7076-1-surenb@google.com
kernel/sched/psi.c