aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace_output.c
diff options
context:
space:
mode:
authorGravatar Tze-nan Wu <Tze-nan.Wu@mediatek.com> 2023-04-26 14:20:23 +0800
committerGravatar Steven Rostedt (Google) <rostedt@goodmis.org> 2023-04-26 09:08:53 -0400
commit7c339fb4d8577792378136c15fde773cfb863cb8 (patch)
treeec62c8837d1eb448143877c16a092e277e22812d /kernel/trace/trace_output.c
parentrecordmcount: Fix memory leaks in the uwrite function (diff)
downloadlinux-7c339fb4d8577792378136c15fde773cfb863cb8.tar.gz
linux-7c339fb4d8577792378136c15fde773cfb863cb8.tar.bz2
linux-7c339fb4d8577792378136c15fde773cfb863cb8.zip
ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset_online_cpus
In ring_buffer_reset_online_cpus, the buffer_size_kb write operation may permanently fail if the cpu_online_mask changes between two for_each_online_buffer_cpu loops. The number of increases and decreases on both cpu_buffer->resize_disabled and cpu_buffer->record_disabled may be inconsistent, causing some CPUs to have non-zero values for these atomic variables after the function returns. This issue can be reproduced by "echo 0 > trace" while hotplugging cpu. After reproducing success, we can find out buffer_size_kb will not be functional anymore. To prevent leaving 'resize_disabled' and 'record_disabled' non-zero after ring_buffer_reset_online_cpus returns, we ensure that each atomic variable has been set up before atomic_sub() to it. Link: https://lore.kernel.org/linux-trace-kernel/20230426062027.17451-1-Tze-nan.Wu@mediatek.com Cc: stable@vger.kernel.org Cc: <mhiramat@kernel.org> Cc: npiggin@gmail.com Fixes: b23d7a5f4a07 ("ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU") Reviewed-by: Cheng-Jui Wang <cheng-jui.wang@mediatek.com> Signed-off-by: Tze-nan Wu <Tze-nan.Wu@mediatek.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_output.c')
0 files changed, 0 insertions, 0 deletions