diff options
author | Eric Paris <eparis@redhat.com> | 2012-01-03 14:23:07 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-17 16:16:58 -0500 |
commit | a4ff8dba7d8ce5ceb43fb27df66292251cc73bdc (patch) | |
tree | 2c89a0a7a7dad853a2c2ec70417ef2f3f5a04fd4 | |
parent | 38cdce53daa0408a61fe6d86fe48f31515c9b840 (diff) |
audit: inline audit_free to simplify the look of generic code
make the conditional a static inline instead of doing it in generic code.
Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r-- | include/linux/audit.h | 7 | ||||
-rw-r--r-- | kernel/auditsc.c | 2 | ||||
-rw-r--r-- | kernel/exit.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 4f1efe3e8616..8eb8bda749b3 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -417,7 +417,7 @@ extern int audit_classify_arch(int arch); | |||
417 | /* Public API */ | 417 | /* Public API */ |
418 | extern void audit_finish_fork(struct task_struct *child); | 418 | extern void audit_finish_fork(struct task_struct *child); |
419 | extern int audit_alloc(struct task_struct *task); | 419 | extern int audit_alloc(struct task_struct *task); |
420 | extern void audit_free(struct task_struct *task); | 420 | extern void __audit_free(struct task_struct *task); |
421 | extern void __audit_syscall_entry(int arch, | 421 | extern void __audit_syscall_entry(int arch, |
422 | int major, unsigned long a0, unsigned long a1, | 422 | int major, unsigned long a0, unsigned long a1, |
423 | unsigned long a2, unsigned long a3); | 423 | unsigned long a2, unsigned long a3); |
@@ -435,6 +435,11 @@ static inline int audit_dummy_context(void) | |||
435 | void *p = current->audit_context; | 435 | void *p = current->audit_context; |
436 | return !p || *(int *)p; | 436 | return !p || *(int *)p; |
437 | } | 437 | } |
438 | static inline void audit_free(struct task_struct *task) | ||
439 | { | ||
440 | if (unlikely(task->audit_context)) | ||
441 | __audit_free(task); | ||
442 | } | ||
438 | static inline void audit_syscall_entry(int arch, int major, unsigned long a0, | 443 | static inline void audit_syscall_entry(int arch, int major, unsigned long a0, |
439 | unsigned long a1, unsigned long a2, | 444 | unsigned long a1, unsigned long a2, |
440 | unsigned long a3) | 445 | unsigned long a3) |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index e1062f66b01b..7aaeb38b262a 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -1594,7 +1594,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
1594 | * | 1594 | * |
1595 | * Called from copy_process and do_exit | 1595 | * Called from copy_process and do_exit |
1596 | */ | 1596 | */ |
1597 | void audit_free(struct task_struct *tsk) | 1597 | void __audit_free(struct task_struct *tsk) |
1598 | { | 1598 | { |
1599 | struct audit_context *context; | 1599 | struct audit_context *context; |
1600 | 1600 | ||
diff --git a/kernel/exit.c b/kernel/exit.c index 94ed6e20bb53..88dcbbc446f7 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -964,8 +964,7 @@ NORET_TYPE void do_exit(long code) | |||
964 | acct_collect(code, group_dead); | 964 | acct_collect(code, group_dead); |
965 | if (group_dead) | 965 | if (group_dead) |
966 | tty_audit_exit(); | 966 | tty_audit_exit(); |
967 | if (unlikely(tsk->audit_context)) | 967 | audit_free(tsk); |
968 | audit_free(tsk); | ||
969 | 968 | ||
970 | tsk->exit_code = code; | 969 | tsk->exit_code = code; |
971 | taskstats_exit(tsk, group_dead); | 970 | taskstats_exit(tsk, group_dead); |