Skip to content

Commit 3ca933a

Browse files
committed
Merge tag 'trace-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fix from Steven Rostedt: - 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. * tag 'trace-v6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: Do not free "head" on error path of filter_free_subsystem_filters()
2 parents dde6379 + 8a157d8 commit 3ca933a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel/trace/trace_events_filter.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,10 +1437,8 @@ static void filter_free_subsystem_filters(struct trace_subsystem_dir *dir,
14371437
INIT_LIST_HEAD(&head->list);
14381438

14391439
item = kmalloc(sizeof(*item), GFP_KERNEL);
1440-
if (!item) {
1441-
kfree(head);
1440+
if (!item)
14421441
goto free_now;
1443-
}
14441442

14451443
item->filter = filter;
14461444
list_add_tail(&item->list, &head->list);

0 commit comments

Comments
 (0)