public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Peter Moody <pmoody@google.com>
Cc: linux-audit@redhat.com
Subject: Re: [PATCH] audit: missing variable declaration/initialization when AUDIT_DEBUG == 2.
Date: Thu, 26 Jul 2012 08:34:19 -0400	[thread overview]
Message-ID: <20120726083419.16bf047f@tlielax.poochiereds.net> (raw)
In-Reply-To: <1342647041-13210-1-git-send-email-pmoody@google.com>

On Wed, 18 Jul 2012 14:30:41 -0700
Peter Moody <pmoody@google.com> wrote:

> Additionally it looks like audit_free_names might return too early when
> AUDIT_DEBUG was set to 2.
> 
> Signed-off-by: Peter Moody <pmoody@google.com>
> ---
>  kernel/auditsc.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 4b96415..0c1db46 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -997,6 +997,7 @@ static inline void audit_free_names(struct audit_context *context)
>  
>  #if AUDIT_DEBUG == 2
>  	if (context->put_count + context->ino_count != context->name_count) {
> +		int i = 0;
>  		printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d"
>  		       " name_count=%d put_count=%d"
>  		       " ino_count=%d [NOT freeing]\n",
> @@ -1005,11 +1006,10 @@ static inline void audit_free_names(struct audit_context *context)
>  		       context->name_count, context->put_count,
>  		       context->ino_count);
>  		list_for_each_entry(n, &context->names_list, list) {
> -			printk(KERN_ERR "names[%d] = %p = %s\n", i,
> +			printk(KERN_ERR "names[%d] = %p = %s\n", i++,
>  			       n->name, n->name ?: "(null)");
>  		}
>  		dump_stack();
> -		return;
>  	}

I'm not certain what the intent of this code was, but if you remove the
"return" above, then the printk above it that says "[NOT FREEING]". Will
no longer be valid.

>  #endif
>  #if AUDIT_DEBUG
> @@ -2084,10 +2084,10 @@ void audit_putname(const char *name)
>  		       __FILE__, __LINE__, context->serial, name);
>  		if (context->name_count) {
>  			struct audit_names *n;
> -			int i;
> +			int i = 0;
>  
>  			list_for_each_entry(n, &context->names_list, list)
> -				printk(KERN_ERR "name[%d] = %p = %s\n", i,
> +				printk(KERN_ERR "name[%d] = %p = %s\n", i++,
>  				       n->name, n->name ?: "(null)");
>  			}
>  #endif

  parent reply	other threads:[~2012-07-26 12:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 21:30 [PATCH] audit: missing variable declaration/initialization when AUDIT_DEBUG == 2 Peter Moody
2012-07-23 15:58 ` Peter Moody
2012-07-26 12:34 ` Jeff Layton [this message]
2012-07-26 15:09   ` Peter Moody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120726083419.16bf047f@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=pmoody@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox