Skip to content

Commit 585abc0

Browse files
YashSuthar983mhiramat
authored andcommitted
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>
1 parent cf24cbb commit 585abc0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/trace/trace_uprobe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ static int uprobe_buffer_enable(void)
912912
{
913913
int ret = 0;
914914

915-
BUG_ON(!mutex_is_locked(&event_mutex));
915+
lockdep_assert_held(&event_mutex);
916916

917917
if (uprobe_buffer_refcnt++ == 0) {
918918
ret = uprobe_buffer_init();
@@ -927,7 +927,7 @@ static void uprobe_buffer_disable(void)
927927
{
928928
int cpu;
929929

930-
BUG_ON(!mutex_is_locked(&event_mutex));
930+
lockdep_assert_held(&event_mutex);
931931

932932
if (--uprobe_buffer_refcnt == 0) {
933933
for_each_possible_cpu(cpu)

0 commit comments

Comments
 (0)