tracing: Wait for preempt irq delay thread to finish
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 6 May 2020 14:20:10 +0000 (10:20 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:59:21 +0000 (07:59 +0200)
commit13946ad1d908e05ca8a2ce61b33f64819c9dc8ea
treef0629961b3d781e942db585a82724277c5249b4b
parent8db9e7e13d5a1f251e2edb1c91862f8bd5ca3968
tracing: Wait for preempt irq delay thread to finish

commit d16a8c31077e75ecb9427fbfea59b74eed00f698 upstream.

Running on a slower machine, it is possible that the preempt delay kernel
thread may still be executing if the module was immediately removed after
added, and this can cause the kernel to crash as the kernel thread might be
executing after its code has been removed.

There's no reason that the caller of the code shouldn't just wait for the
delay thread to finish, as the thread can also be created by a trigger in
the sysfs code, which also has the same issues.

Link: http://lore.kernel.org/r/5EA2B0C8.2080706@cn.fujitsu.com
Cc: stable@vger.kernel.org
Fixes: 793937236d1ee ("lib: Add module for testing preemptoff/irqsoff latency tracers")
Reported-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Joel Fernandes <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/preemptirq_delay_test.c