# Re: \[PATCH\] tracing: Fix crash passing ERR\_PTR to kthread\_stop()

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2026-08-16 23:15:17 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/08/17419275
- Thread: https://ratatoskr.run/sashiko-reviews/2026/08/17419275/t.md

```text
On Sat, 15 Aug 2026 19:10:34 +0000
sashiko-bot@kernel.org wrote:

> > 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
```
