summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYash Suthar <yashsuthar983@gmail.com>2026-06-01 23:35:21 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-06-01 23:35:21 +0900
commit585abc02be3d3ab82fbcc4dbcbbf0ceb61a02129 (patch)
tree8beef641920d7ced2140152982169f4b2afe5363
parentcf24cbb4e5861caacfdb5bface90b80eaa26e649 (diff)
tracing: Replace BUG_ON with lockdep_assert_held in uprobe_buffer functions
Replace BUG_ON(!mutex_is_locked(&event_mutex)) with lockdep_assert_held(&event_mutex) in uprobe_buffer_enable() and uprobe_buffer_disable(). BUG_ON() will crash the kernel. mutex_is_locked() only checks if any task holds lock,but not the caller task. lockdep_assert_held() also check current task for lock and no crash on true condition. Link: https://lore.kernel.org/all/20260521192846.8306-1-yashsuthar983@gmail.com/ Signed-off-by: Yash Suthar <yashsuthar983@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
-rw-r--r--kernel/trace/trace_uprobe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c5ee7920dec6..c274346853d1 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -912,7 +912,7 @@ static int uprobe_buffer_enable(void)
{
int ret = 0;
- BUG_ON(!mutex_is_locked(&event_mutex));
+ lockdep_assert_held(&event_mutex);
if (uprobe_buffer_refcnt++ == 0) {
ret = uprobe_buffer_init();
@@ -927,7 +927,7 @@ static void uprobe_buffer_disable(void)
{
int cpu;
- BUG_ON(!mutex_is_locked(&event_mutex));
+ lockdep_assert_held(&event_mutex);
if (--uprobe_buffer_refcnt == 0) {
for_each_possible_cpu(cpu)