Merge tag 'audit-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoor...
[linux-2.6-microblaze.git] / kernel / auditsc.c
index 79a5da1..9f8c052 100644 (file)
@@ -965,7 +965,7 @@ static void audit_reset_context(struct audit_context *ctx)
        if (!ctx)
                return;
 
-       /* if ctx is non-null, reset the "ctx->state" regardless */
+       /* if ctx is non-null, reset the "ctx->context" regardless */
        ctx->context = AUDIT_CTX_UNUSED;
        if (ctx->dummy)
                return;
@@ -1002,7 +1002,7 @@ static void audit_reset_context(struct audit_context *ctx)
        kfree(ctx->sockaddr);
        ctx->sockaddr = NULL;
        ctx->sockaddr_len = 0;
-       ctx->pid = ctx->ppid = 0;
+       ctx->ppid = 0;
        ctx->uid = ctx->euid = ctx->suid = ctx->fsuid = KUIDT_INIT(0);
        ctx->gid = ctx->egid = ctx->sgid = ctx->fsgid = KGIDT_INIT(0);
        ctx->personality = 0;
@@ -1016,7 +1016,6 @@ static void audit_reset_context(struct audit_context *ctx)
        WARN_ON(!list_empty(&ctx->killed_trees));
        audit_free_module(ctx);
        ctx->fds[0] = -1;
-       audit_proctitle_free(ctx);
        ctx->type = 0; /* reset last for audit_free_*() */
 }
 
@@ -1077,6 +1076,7 @@ static inline void audit_free_context(struct audit_context *context)
 {
        /* resetting is extra work, but it is likely just noise */
        audit_reset_context(context);
+       audit_proctitle_free(context);
        free_tree_refs(context);
        kfree(context->filterkey);
        kfree(context);
@@ -1833,7 +1833,7 @@ void __audit_free(struct task_struct *tsk)
 
        /* We are called either by do_exit() or the fork() error handling code;
         * in the former case tsk == current and in the latter tsk is a
-        * random task_struct that doesn't doesn't have any meaningful data we
+        * random task_struct that doesn't have any meaningful data we
         * need to log via audit_log_exit().
         */
        if (tsk == current && !context->dummy) {
@@ -2069,7 +2069,7 @@ void __audit_syscall_exit(int success, long return_code)
        /* run through both filters to ensure we set the filterkey properly */
        audit_filter_syscall(current, context);
        audit_filter_inodes(current, context);
-       if (context->current_state < AUDIT_STATE_RECORD)
+       if (context->current_state != AUDIT_STATE_RECORD)
                goto out;
 
        audit_log_exit();