[PATCH 1/2] audit: drop BUG_ON() from audit_add_to_parent()
Ricardo Robaina <[email protected]> Tue, 28 Jul 2026 11:14:23 -0300
| Newsgroups | org.kernel.vger.audit,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <e0e6505a3f80912216dd834d25f330b818d73263.1785246707.git.rrobaina@redhat.com> |
The BUG_ON(!mutex_is_locked(&audit_filter_mutex)) check in audit_add_to_parent() will panic the kernel if the mutex is not held, which is too severe for this situation. Replace it with lockdep_assert_held(), instead. Signed-off-by: Ricardo Robaina <[email protected]> --- kernel/audit_watch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 06dd0ebe73e2..4ac8a91e9ba8 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -372,7 +372,7 @@ static void audit_add_to_parent(struct audit_krule *krule, struct audit_watch *w, *watch = krule->watch; int watch_found = 0; - BUG_ON(!mutex_is_locked(&audit_filter_mutex)); + lockdep_assert_held(&audit_filter_mutex); list_for_each_entry(w, &parent->watches, wlist) { if (strcmp(watch->path, w->path)) -- 2.53.0