mirror of https://gitee.com/openkylin/linux.git
Merge branch 'audit-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs
Pull audit-tree fixes from Miklos Szeredi: "The audit subsystem maintainers (Al and Eric) are not responding to repeated resends. Eric did ack them a while ago, but no response since then. So I'm sending these directly to you." * 'audit-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs: audit: clean up refcounting in audit-tree audit: fix refcounting in audit-tree audit: don't free_chunk() after fsnotify_add_mark()
This commit is contained in:
commit
1456c75a80
|
@ -250,7 +250,6 @@ static void untag_chunk(struct node *p)
|
||||||
spin_unlock(&hash_lock);
|
spin_unlock(&hash_lock);
|
||||||
spin_unlock(&entry->lock);
|
spin_unlock(&entry->lock);
|
||||||
fsnotify_destroy_mark(entry);
|
fsnotify_destroy_mark(entry);
|
||||||
fsnotify_put_mark(entry);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +258,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +292,7 @@ static void untag_chunk(struct node *p)
|
||||||
spin_unlock(&hash_lock);
|
spin_unlock(&hash_lock);
|
||||||
spin_unlock(&entry->lock);
|
spin_unlock(&entry->lock);
|
||||||
fsnotify_destroy_mark(entry);
|
fsnotify_destroy_mark(entry);
|
||||||
fsnotify_put_mark(entry);
|
fsnotify_put_mark(&new->mark); /* drop initial reference */
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
Fallback:
|
Fallback:
|
||||||
|
@ -322,7 +321,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +346,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
|
||||||
insert_hash(chunk);
|
insert_hash(chunk);
|
||||||
spin_unlock(&hash_lock);
|
spin_unlock(&hash_lock);
|
||||||
spin_unlock(&entry->lock);
|
spin_unlock(&entry->lock);
|
||||||
|
fsnotify_put_mark(entry); /* drop initial reference */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -444,8 +444,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
|
||||||
spin_unlock(&chunk_entry->lock);
|
spin_unlock(&chunk_entry->lock);
|
||||||
spin_unlock(&old_entry->lock);
|
spin_unlock(&old_entry->lock);
|
||||||
fsnotify_destroy_mark(old_entry);
|
fsnotify_destroy_mark(old_entry);
|
||||||
|
fsnotify_put_mark(chunk_entry); /* drop initial reference */
|
||||||
fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
|
fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
|
||||||
fsnotify_put_mark(old_entry); /* and kill it */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,7 +916,12 @@ static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify
|
||||||
struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
|
struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
|
||||||
|
|
||||||
evict_chunk(chunk);
|
evict_chunk(chunk);
|
||||||
fsnotify_put_mark(entry);
|
|
||||||
|
/*
|
||||||
|
* We are guaranteed to have at least one reference to the mark from
|
||||||
|
* either the inode or the caller of fsnotify_destroy_mark().
|
||||||
|
*/
|
||||||
|
BUG_ON(atomic_read(&entry->refcnt) < 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
|
static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
|
||||||
|
|
Loading…
Reference in New Issue