Skip to content

Commit

Permalink
[PATCH] simplify audit_free() locking
Browse files Browse the repository at this point in the history
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@elte.hu>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Ingo Molnar authored and Al Viro committed Mar 20, 2006
1 parent d9d9ec6 commit 4023e02
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kernel/auditsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,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;

Expand Down

0 comments on commit 4023e02

Please sign in to comment.