[patch 3/3] simplify audit_free() locking

akpm at osdl.org akpm at osdl.org
Wed Mar 8 07:51:39 UTC 2006


From: Ingo Molnar <mingo at elte.hu>

Simplify audit_free()'s locking: no need to lock a task that we are tearing
down.  [the extra locking also caused false positives in the lock
validator]

Signed-off-by: Ingo Molnar <mingo at elte.hu>
Cc: David Woodhouse <dwmw2 at infradead.org>
Signed-off-by: Andrew Morton <akpm at osdl.org>
---

 kernel/auditsc.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff -puN kernel/auditsc.c~simplify-audit_free-locking kernel/auditsc.c
--- devel/kernel/auditsc.c~simplify-audit_free-locking	2006-02-21 19:11:13.000000000 -0800
+++ devel-akpm/kernel/auditsc.c	2006-02-21 19:11:13.000000000 -0800
@@ -686,10 +686,14 @@ void audit_free(struct task_struct *tsk)
 {
 	struct audit_context *context;
 
-	task_lock(tsk);
+	/*
+	 * No need to lock the task - when we execute audit_free()
+	 * then the task has no external references anymore, and
+	 * we are tearing it down. (The locking also confuses
+	 * DEBUG_LOCKDEP - this freeing may occur in softirq
+	 * contexts as well, via RCU.)
+	 */
 	context = audit_get_context(tsk, 0, 0);
-	task_unlock(tsk);
-
 	if (likely(!context))
 		return;
 
_




More information about the Linux-audit mailing list