[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260121023509.410423-1-longman@redhat.com>
Date: Tue, 20 Jan 2026 21:35:08 -0500
From: Waiman Long <longman@...hat.com>
To: Paul Moore <paul@...l-moore.com>,
Eric Paris <eparis@...hat.com>,
Christian Brauner <brauner@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>
Cc: linux-kernel@...r.kernel.org,
audit@...r.kernel.org,
Richard Guy Briggs <rgb@...hat.com>,
Ricardo Robaina <rrobaina@...hat.com>,
Waiman Long <longman@...hat.com>
Subject: [PATCH 1/2] audit: Quit audit_free_names() early if name list empty
Optimize audit_free_names() by quitting early if the name list is empty.
This eliminates the need to acquire and release the fs_struct spinlock
in path_put().
Signed-off-by: Waiman Long <longman@...hat.com>
---
kernel/auditsc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index dd0563a8e0be..824b6fd98561 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -931,6 +931,9 @@ static inline void audit_free_names(struct audit_context *context)
{
struct audit_names *n, *next;
+ if (list_empty(&context->names_list))
+ return; /* audit_alloc_name() has not been called */
+
list_for_each_entry_safe(n, next, &context->names_list, list) {
list_del(&n->list);
if (n->name)
--
2.52.0
Powered by blists - more mailing lists