This is a note to let you know that I've just added the patch titled tracing/probes: Fix to search structure fields correctly to the 6.7-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-search-structure-fields-correctly.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9704669c386f9bbfef2e002e7e690c56b7dcf5de Mon Sep 17 00:00:00 2001 From: "Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> Date: Sat, 17 Feb 2024 21:25:42 +0900 Subject: tracing/probes: Fix to search structure fields correctly From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> commit 9704669c386f9bbfef2e002e7e690c56b7dcf5de upstream. Fix to search a field from the structure which has anonymous union correctly. Since the reference `type` pointer was updated in the loop, the search loop suddenly aborted where it hits an anonymous union. Thus it can not find the field after the anonymous union. This avoids updating the cursor `type` pointer in the loop. Link: https://lore.kernel.org/all/170791694361.389532.10047514554799419688.stgit@devnote2/ Fixes: 302db0f5b3d8 ("tracing/probes: Add a function to search a member of a struct/union") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/trace/trace_btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_btf.c b/kernel/trace/trace_btf.c index ca224d53bfdc..5bbdbcbbde3c 100644 --- a/kernel/trace/trace_btf.c +++ b/kernel/trace/trace_btf.c @@ -91,8 +91,8 @@ const struct btf_member *btf_find_struct_member(struct btf *btf, for_each_member(i, type, member) { if (!member->name_off) { /* Anonymous union/struct: push it for later use */ - type = btf_type_skip_modifiers(btf, member->type, &tid); - if (type && top < BTF_ANON_STACK_MAX) { + if (btf_type_skip_modifiers(btf, member->type, &tid) && + top < BTF_ANON_STACK_MAX) { anon_stack[top].tid = tid; anon_stack[top++].offset = cur_offset + member->offset; -- 2.43.2 Patches currently in stable-queue which might be from mhiramat@xxxxxxxxxx are queue-6.7/tracing-probes-fix-to-set-arg-size-and-fmt-after-setting-type-from-btf.patch queue-6.7/tracing-fix-wasted-memory-in-saved_cmdlines-logic.patch queue-6.7/tracing-synthetic-fix-trace_string-return-value.patch queue-6.7/tracing-probes-fix-to-search-structure-fields-correctly.patch queue-6.7/tracing-timerlat-move-hrtimer_init-to-timerlat_fd-open.patch queue-6.7/tracing-probes-fix-to-show-a-parse-error-for-bad-type-for-comm.patch queue-6.7/tracing-trigger-fix-to-return-error-if-failed-to-alloc-snapshot.patch