This is a note to let you know that I've just added the patch titled tracing/probes: Fix to avoid double count of the string length on the array to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tracing-probes-fix-to-avoid-double-count-of-the-string-length-on-the-array.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 66bcf65d6cf0ca6540e2341e88ee7ef02dbdda08 Mon Sep 17 00:00:00 2001 From: "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> Date: Tue, 11 Jul 2023 23:15:29 +0900 Subject: tracing/probes: Fix to avoid double count of the string length on the array From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> commit 66bcf65d6cf0ca6540e2341e88ee7ef02dbdda08 upstream. If an array is specified with the ustring or symstr, the length of the strings are accumlated on both of 'ret' and 'total', which means the length is double counted. Just set the length to the 'ret' value for avoiding double counting. Link: https://lore.kernel.org/all/168908492917.123124.15076463491122036025.stgit@devnote2/ Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/ Fixes: 88903c464321 ("tracing/probe: Add ustring type for user-space string") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/trace/trace_probe_tmpl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_probe_tmpl.h +++ b/kernel/trace/trace_probe_tmpl.h @@ -156,11 +156,11 @@ stage3: code++; goto array; case FETCH_OP_ST_USTRING: - ret += fetch_store_strlen_user(val + code->offset); + ret = fetch_store_strlen_user(val + code->offset); code++; goto array; case FETCH_OP_ST_SYMSTR: - ret += fetch_store_symstrlen(val + code->offset); + ret = fetch_store_symstrlen(val + code->offset); code++; goto array; default: Patches currently in stable-queue which might be from mhiramat@xxxxxxxxxx are queue-6.4/tracing-probes-fix-to-avoid-double-count-of-the-string-length-on-the-array.patch queue-6.4/fprobe-release-rethook-after-the-ftrace_ops-is-unregistered.patch queue-6.4/revert-tracing-add-fault-name-injection-to-kernel-probes.patch queue-6.4/tracing-probes-fix-to-update-dynamic-data-counter-if-fetcharg-uses-it.patch queue-6.4/fprobe-ensure-running-fprobe_exit_handler-finished-before-calling-rethook_free.patch queue-6.4/tracing-probes-fix-to-record-0-length-data_loc-in-fetch_store_string-if-fails.patch queue-6.4/tracing-fix-null-pointer-dereference-in-tracing_err_log_open.patch queue-6.4/fprobe-add-unlock-to-match-a-succeeded-ftrace_test_r.patch queue-6.4/kernel-trace-fix-cleanup-logic-of-enable_trace_eprob.patch queue-6.4/tracing-probes-fix-not-to-count-error-code-to-total-length.patch