Skip to content

Commit

Permalink
audit: don't free_chunk() after fsnotify_add_mark()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Eric Paris <[email protected]>
CC: [email protected]
  • Loading branch information
Miklos Szeredi committed Aug 15, 2012
1 parent ddf343f commit 0fe33aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0fe33aa

Please sign in to comment.