From: Ingo Molnar Date: Wed, 8 Mar 2006 07:51:39 +0000 (-0800) Subject: [PATCH] simplify audit_free() locking X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4023e020807ea249ae83f0d1d851b4c7cf0afd8a;p=linux.git [PATCH] simplify audit_free() locking 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 Cc: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- diff --git a/kernel/auditsc.c b/kernel/auditsc.c index d3d499272d139..b613ec89e99c1 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -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;