linux-stable/samples
Mark Rutland 8be9fbd534 ftrace: Export ftrace_free_filter() to modules
Setting filters on an ftrace ops results in some memory being allocated
for the filter hashes, which must be freed before the ops can be freed.
This can be done by removing every individual element of the hash by
calling ftrace_set_filter_ip() or ftrace_set_filter_ips() with `remove`
set, but this is somewhat error prone as it's easy to forget to remove
an element.

Make it easier to clean this up by exporting ftrace_free_filter(), which
can be used to clean up all of the filter hashes after an ftrace_ops has
been unregistered.

Using this, fix the ftrace-direct* samples to free hashes prior to being
unloaded. All other code either removes individual filters explicitly or
is built-in and already calls ftrace_free_filter().

Link: https://lkml.kernel.org/r/20230103124912.2948963-3-mark.rutland@arm.com

Cc: stable@vger.kernel.org
Cc: Florent Revest <revest@chromium.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: e1067a07cf ("ftrace/samples: Add module to test multi direct modify interface")
Fixes: 5fae941b9a ("ftrace/samples: Add multi direct interface test module")
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2023-01-24 11:20:58 -05:00
..
acrn virt: acrn: Mark the uuid field as unused 2022-11-23 19:55:22 +01:00
auxdisplay
binderfs
bpf samples/bpf: Fix wrong allocation size in xdp_router_ipv4_user 2022-11-25 00:21:29 +01:00
configfs
connector
coresight
fanotify
fprobe Fixes and minor clean ups for tracing: 2022-07-12 16:17:40 -07:00
ftrace ftrace: Export ftrace_free_filter() to modules 2023-01-24 11:20:58 -05:00
hidraw
hw_breakpoint
kdb
kfifo
kmemleak
kobject
kprobes samples: Use KSYM_NAME_LEN for kprobes 2022-07-12 16:36:45 -04:00
landlock samples/landlock: Document best-effort approach for LANDLOCK_ACCESS_FS_REFER 2022-11-07 20:49:50 +01:00
livepatch
mei
nitro_enclaves
pidfd
pktgen samples: pktgen: Use "grep -E" instead of "egrep" 2022-11-22 13:23:48 +01:00
qmi soc: qcom: qmi: use const for struct qmi_elem_info 2022-08-29 17:33:01 -05:00
rpmsg
rust rust: macros: take string literals in `module!` 2022-12-04 01:59:15 +01:00
seccomp
timers
trace_events tracing: Fix cpumask() example typo 2022-12-14 11:17:55 -05:00
trace_printk
uhid
user_events tracing/user_events: Use bits vs bytes for enabled status page data 2022-09-29 10:17:37 -04:00
v4l treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 2) 2022-06-10 14:51:36 +02:00
vfio-mdev samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe() 2022-12-12 14:10:12 -07:00
vfs
watch_queue
watchdog
Kconfig samples: add first Rust examples 2022-09-28 09:03:08 +02:00
Makefile samples: add first Rust examples 2022-09-28 09:03:08 +02:00