]> git.baikalelectronics.ru Git - kernel.git/commit
tracing/ring-buffer: Only do full wait when cpu != RING_BUFFER_ALL_CPUS
authorPratyush Yadav <ptyadav@amazon.de>
Fri, 16 Dec 2022 13:42:41 +0000 (14:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:46 +0000 (11:40 +0100)
commite1d026bff1826d39557ab6f90d684bbc0acb2a48
tree624ed5fad367c55bf71aab60ccb8c44bf910fe3c
parent569dbd5792af796125c63420b0c3a4967d1bf697
tracing/ring-buffer: Only do full wait when cpu != RING_BUFFER_ALL_CPUS

full_hit() directly uses cpu as an array index. Since
RING_BUFFER_ALL_CPUS == -1, calling full_hit() with cpu ==
RING_BUFFER_ALL_CPUS will cause an invalid memory access.

The upstream commit 91cd29d9297d ("tracing/ring-buffer: Have polling
block on watermark") already does this. This was missed when backporting
to v5.4.y.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Fixes: 37637ff938bd ("tracing/ring-buffer: Have polling block on watermark")
Signed-off-by: Pratyush Yadav <ptyadav@amazon.de>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/ring_buffer.c