aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-26 07:04:57 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-05-26 07:04:57 -0400
commit7551ced334ce6eb2a7a765309871e619f645add1 (patch)
treeb34088792efdf335e6a2c02a9c97768da84a695a
parent37ca5389b863e5ffba6fb7c22331bf57dbf7764a (diff)
AUDIT: Defer freeing aux items until audit_free_context()
While they were all just simple blobs it made sense to just free them as we walked through and logged them. Now that there are pointers to other objects which need refcounting, we might as well revert to _only_ logging them in audit_log_exit(), and put the code to free them properly in only one place -- in audit_free_aux(). Signed-off-by: David Woodhouse <dwmw2@infradead.org> ----------------------------------------------------------
-rw-r--r--kernel/auditsc.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index b45677eba78f..7556c479d5af 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -675,6 +675,7 @@ static void audit_log_exit(struct audit_context *context)
675{ 675{
676 int i; 676 int i;
677 struct audit_buffer *ab; 677 struct audit_buffer *ab;
678 struct audit_aux_data *aux;
678 679
679 ab = audit_log_start(context, AUDIT_SYSCALL); 680 ab = audit_log_start(context, AUDIT_SYSCALL);
680 if (!ab) 681 if (!ab)
@@ -705,10 +706,8 @@ static void audit_log_exit(struct audit_context *context)
705 context->egid, context->sgid, context->fsgid); 706 context->egid, context->sgid, context->fsgid);
706 audit_log_task_info(ab); 707 audit_log_task_info(ab);
707 audit_log_end(ab); 708 audit_log_end(ab);
708 while (context->aux) {
709 struct audit_aux_data *aux;
710 709
711 aux = context->aux; 710 for (aux = context->aux; aux; aux = aux->next) {
712 711
713 ab = audit_log_start(context, aux->type); 712 ab = audit_log_start(context, aux->type);
714 if (!ab) 713 if (!ab)
@@ -740,15 +739,10 @@ static void audit_log_exit(struct audit_context *context)
740 case AUDIT_AVC_PATH: { 739 case AUDIT_AVC_PATH: {
741 struct audit_aux_data_path *axi = (void *)aux; 740 struct audit_aux_data_path *axi = (void *)aux;
742 audit_log_d_path(ab, "path=", axi->dentry, axi->mnt); 741 audit_log_d_path(ab, "path=", axi->dentry, axi->mnt);
743 dput(axi->dentry);
744 mntput(axi->mnt);
745 break; } 742 break; }
746 743
747 } 744 }
748 audit_log_end(ab); 745 audit_log_end(ab);
749
750 context->aux = aux->next;
751 kfree(aux);
752 } 746 }
753 747
754 for (i = 0; i < context->name_count; i++) { 748 for (i = 0; i < context->name_count; i++) {