From: Miklos Szeredi Date: Wed, 15 Aug 2012 10:55:22 +0000 (+0200) Subject: audit: don't free_chunk() after fsnotify_add_mark() X-Git-Tag: v3.0.43~29 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=56e4562bb32d8a47485a9b8b868cb28fda595170;p=unionfs-2.6.39.y.git audit: don't free_chunk() after fsnotify_add_mark() commit 0fe33aae0e94b4097dd433c9399e16e17d638cd8 upstream. 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 Acked-by: Eric Paris Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index e99dda04b12..0cf6a0a51a1 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c @@ -265,7 +265,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; } @@ -328,7 +328,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; } @@ -402,7 +402,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; }