]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing/osnoise: Call synchronize_rcu() when unregistering
authorCrystal Wood <crwood@redhat.com>
Tue, 9 Jun 2026 04:54:30 +0000 (23:54 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 6 Jul 2026 18:56:18 +0000 (14:56 -0400)
This ensures that any RCU readers traversing the instance list
have finished, before releasing the reference on the tracer that
the instance points to.

Cc: stable@vger.kernel.org
Fixes: a6ed2aee54644 ("tracing: Switch to kvfree_rcu() API")
Link: https://patch.msgid.link/20260609045430.1589786-1-crwood@redhat.com
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Crystal Wood <crwood@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_osnoise.c

index 5e83c4f6f2b429c432ddf6ff387ac7426c615b83..0e1265acd1ccc07ed776d59fb16c98a15377dd8d 100644 (file)
@@ -179,7 +179,9 @@ static void osnoise_unregister_instance(struct trace_array *tr)
        if (!found)
                return;
 
-       kvfree_rcu_mightsleep(inst);
+       /* Do a full sync to ensure that tr remains valid, not just inst */
+       synchronize_rcu();
+       kvfree(inst);
 }
 
 /*