Re: [PATCH] tracing: Fix crash passing ERR_PTR to kthread_stop()

From
Steven Rostedt <rostedt@goodmis.org>
Date
2026-08-16 23:15:17
Also in
sashiko-reviews
Reply to
sashiko-bot@kernel.org, 2026-08-15
On Sat, 15 Aug 2026 19:10:34 +0000
sashiko-bot@kernel.org wrote:
quoted
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0356cae0cf74e..207f47f54dbbf 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -3866,6 +3866,8 @@ static __init void event_test_stuff(void)
 	struct task_struct *test_thread;
 
 	test_thread = kthread_run(event_test_thread, NULL, "test-events");
+	if (IS_ERR(test_thread))
+		return;  
[Severity: Medium]
Does returning silently here cause the self-test framework to falsely report
success when the workload thread cannot be created?

The caller event_trace_self_tests() unconditionally prints "OK" after calling
this function:

kernel/trace/trace_events.c:event_trace_self_tests() {
        ...
		ftrace_event_enable_disable(file, 1);
		event_test_stuff();
		ftrace_event_enable_disable(file, 0);

		pr_cont("OK\n");
	}
        ...
}

Should event_test_stuff() propagate the error so that the caller can correctly
report the test failure or skip it appropriately?
Right, this is just a boot up test that is only done for debugging.
This is not something for production. If it fails, it should not fail
silently. If anything, it should be:

	if (WARN_ON(IS_ERR(test_thread))
		return;

-- Steve
Thread (3 messages) 3 messages, 3 authors, last reply 2026-08-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help