All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: viro@ZenIV.linux.org.uk, linux-kernel@vger.kernel.org,
	mszeredi@suse.cz, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] audit: don't free_chunk() after fsnotify_add_mark()
Date: Fri, 06 Jul 2012 13:43:49 -0400	[thread overview]
Message-ID: <1341596629.5347.0.camel@localhost> (raw)
In-Reply-To: <1340646378-5169-2-git-send-email-miklos@szeredi.hu>

On Mon, 2012-06-25 at 19:46 +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@suse.cz>
> 
> Don't do free_chunk() after fsnotify_add_mark().  That one does a delayed unref
> via the destroy list and this results in use-after-free.
> 
> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
> CC: stable@vger.kernel.org

Al, can you send these along?  I am not going to see a computer again
for a month.  Hurray!

Acked-by: Eric Paris <eparis@redhat.com>

> ---
>  kernel/audit_tree.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
> index 5bf0790..d52d247 100644
> --- a/kernel/audit_tree.c
> +++ b/kernel/audit_tree.c
> @@ -259,7 +259,7 @@ static void untag_chunk(struct node *p)
>  
>  	fsnotify_duplicate_mark(&new->mark, entry);
>  	if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) {
> -		free_chunk(new);
> +		fsnotify_put_mark(&new->mark);
>  		goto Fallback;
>  	}
>  
> @@ -322,7 +322,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
>  
>  	entry = &chunk->mark;
>  	if (fsnotify_add_mark(entry, audit_tree_group, inode, NULL, 0)) {
> -		free_chunk(chunk);
> +		fsnotify_put_mark(entry);
>  		return -ENOSPC;
>  	}
>  
> @@ -396,7 +396,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
>  	fsnotify_duplicate_mark(chunk_entry, old_entry);
>  	if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->i.inode, NULL, 1)) {
>  		spin_unlock(&old_entry->lock);
> -		free_chunk(chunk);
> +		fsnotify_put_mark(chunk_entry);
>  		fsnotify_put_mark(old_entry);
>  		return -ENOSPC;
>  	}



  reply	other threads:[~2012-07-06 18:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25 17:46 [PATCH 0/3] audit-tree fixes Miklos Szeredi
2012-06-25 17:46 ` [PATCH 1/3] audit: don't free_chunk() after fsnotify_add_mark() Miklos Szeredi
2012-07-06 17:43   ` Eric Paris [this message]
2012-06-25 17:46 ` [PATCH 2/3] audit: fix refcounting in audit-tree Miklos Szeredi
2012-07-06 17:52   ` Eric Paris
2012-07-11 22:24     ` Miklos Szeredi
2012-06-25 17:46 ` [PATCH 3/3] audit: clean up " Miklos Szeredi
2012-07-06 17:51   ` Eric Paris
2012-07-11 22:25     ` Miklos Szeredi
2012-07-03 11:15 ` [PATCH 0/3] audit-tree fixes Miklos Szeredi
  -- strict thread matches above, loose matches on Subject: below --
2012-08-15 13:49 [PATCH 0/3] audit-tree fixes (resend) Miklos Szeredi
2012-08-15 13:49 ` [PATCH 1/3] audit: don't free_chunk() after fsnotify_add_mark() Miklos Szeredi
2012-08-21 19:03 [PATCH 0/3] audit-tree fixes Miklos Szeredi
2012-08-21 19:03 ` [PATCH 1/3] audit: don't free_chunk() after fsnotify_add_mark() Miklos Szeredi

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=1341596629.5347.0.camel@localhost \
    --to=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mszeredi@suse.cz \
    --cc=stable@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.