summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-04-03 16:47:58 +0200
committerJan Kara <jack@suse.cz>2017-04-10 17:36:32 +0200
commit43471d15df0e7c40ca4df1513fc1dcf5765396ac (patch)
treee9bfceaddfdee63e428f49ea2bf2844f9a67b265
parentaudit: Abstract hash key handling (diff)
downloadlinux-43471d15df0e7c40ca4df1513fc1dcf5765396ac.tar.xz
linux-43471d15df0e7c40ca4df1513fc1dcf5765396ac.zip
audit_tree: Use mark flags to check whether mark is alive
Currently audit code uses checking of mark->inode to verify whether mark is still alive. Switch that to checking mark flags as that is more logical and current way will become unreliable in future. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--kernel/audit_tree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 11c7ac441624..51451245936a 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -190,7 +190,7 @@ static void insert_hash(struct audit_chunk *chunk)
unsigned long key = chunk_to_key(chunk);
struct list_head *list;
- if (!key)
+ if (!(chunk->mark.flags & FSNOTIFY_MARK_FLAG_ATTACHED))
return;
list = chunk_hash(key);
list_add_rcu(&chunk->hash, list);
@@ -248,7 +248,7 @@ static void untag_chunk(struct node *p)
mutex_lock(&entry->group->mark_mutex);
spin_lock(&entry->lock);
- if (chunk->dead || !entry->inode) {
+ if (chunk->dead || !(entry->flags & FSNOTIFY_MARK_FLAG_ATTACHED)) {
spin_unlock(&entry->lock);
mutex_unlock(&entry->group->mark_mutex);
if (new)
@@ -408,7 +408,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
mutex_lock(&old_entry->group->mark_mutex);
spin_lock(&old_entry->lock);
- if (!old_entry->inode) {
+ if (!(old_entry->flags & FSNOTIFY_MARK_FLAG_ATTACHED)) {
/* old_entry is being shot, lets just lie */
spin_unlock(&old_entry->lock);
mutex_unlock(&old_entry->group->mark_mutex);