mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-06-21 15:43:21 +02:00
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>
This commit is contained in:
committed by
Masami Hiramatsu (Google)
parent
cf24cbb4e5
commit
585abc02be
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user