Skip to contentSkip to conversation

tracing: Fixes for v6.16

GIT PULL Steven Rostedt 2 participants 3 messages Jun 13, 2025 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

tracing fix for 6.16:

- Do not free "head" variable in filter_free_subsystem_filters()

The first error path jumps to "free_now" label but first frees the newly allocated "head" variable. But the "free_now" code checks this variable, and if it is not NULL, it will iterate the list. As this list variable was already initialized, the "free_now" code will not do anything as it is empty. But freeing it will cause a UAF bug. The error path should simply jump to the "free_now" label and leave the "head" variable alone.

Please pull the latest trace-v6.16-rc1 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.16-rc1

Tag SHA1: 3dec58ebef0af8431ecffae2b1814a11b86dbde1 Head SHA1: 8a157d8a00e815cab4432653cb50c9cedbbb4931

Steven Rostedt (1):
tracing: Do not free "head" on error path of filter_free_subsystem_filters()

----

 kernel/trace/trace_events_filter.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

---------------------------

kernel/trace/trace_events_filter.c +1 -3
index ea8b364b6818..08141f105c95 100644
@@ -1437,10 +1437,8 @@ static void filter_free_subsystem_filters(struct trace_subsystem_dir *dir,
 	INIT_LIST_HEAD(&head->list);
 
 	item = kmalloc(sizeof(*item), GFP_KERNEL);
-	if (!item) {
-		kfree(head);
+	if (!item)
 		goto free_now;
-	}
 
 	item->filter = filter;
 	list_add_tail(&item->list, &head->list);
#1 lore raw
Quoted 6 lines · Steven Rostedt

git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.16-rc1

Tag SHA1: 3dec58ebef0af8431ecffae2b1814a11b86dbde1 Head SHA1: 8a157d8a00e815cab4432653cb50c9cedbbb4931

I see the HEAD in the 'trace/fixes' branch, but no tags anywhere. Forgot to push?

Linus

author maintainer
#2 lore raw
Quoted 2 lines · On Fri, 13 Jun 2025 10:05:17 -0700 Linus Torvalds…

I see the HEAD in the 'trace/fixes' branch, but no tags anywhere. Forgot to push?

Yep. Sorry about that.

I just pushed it now.

-- Steve