Commit 7d78916c authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Ben Hutchings

audit: don't free_chunk() after fsnotify_add_mark()

commit 0fe33aae 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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Acked-by: default avatarEric Paris <eparis@redhat.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 43007cdf
...@@ -259,7 +259,7 @@ static void untag_chunk(struct node *p) ...@@ -259,7 +259,7 @@ static void untag_chunk(struct node *p)
fsnotify_duplicate_mark(&new->mark, entry); fsnotify_duplicate_mark(&new->mark, entry);
if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) { 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; goto Fallback;
} }
...@@ -322,7 +322,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) ...@@ -322,7 +322,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
entry = &chunk->mark; entry = &chunk->mark;
if (fsnotify_add_mark(entry, audit_tree_group, inode, NULL, 0)) { if (fsnotify_add_mark(entry, audit_tree_group, inode, NULL, 0)) {
free_chunk(chunk); fsnotify_put_mark(entry);
return -ENOSPC; return -ENOSPC;
} }
...@@ -396,7 +396,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) ...@@ -396,7 +396,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
fsnotify_duplicate_mark(chunk_entry, old_entry); fsnotify_duplicate_mark(chunk_entry, old_entry);
if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->i.inode, NULL, 1)) { if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->i.inode, NULL, 1)) {
spin_unlock(&old_entry->lock); spin_unlock(&old_entry->lock);
free_chunk(chunk); fsnotify_put_mark(chunk_entry);
fsnotify_put_mark(old_entry); fsnotify_put_mark(old_entry);
return -ENOSPC; return -ENOSPC;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment