Skip to content

Commit

Permalink
audit: Provide helper for dropping mark's chunk reference
Browse files Browse the repository at this point in the history
Provide a helper function audit_mark_put_chunk() for dropping mark's
reference (which has to happen only after RCU grace period expires).
Currently that happens only from a single place but in later patches we
introduce more callers.

Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Jan Kara authored and Paul Moore committed Nov 12, 2018
1 parent 8cd0feb commit a837571
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,20 @@ static void __put_chunk(struct rcu_head *rcu)
audit_put_chunk(chunk);
}

/*
* Drop reference to the chunk that was held by the mark. This is the reference
* that gets dropped after we've removed the chunk from the hash table and we
* use it to make sure chunk cannot be freed before RCU grace period expires.
*/
static void audit_mark_put_chunk(struct audit_chunk *chunk)
{
call_rcu(&chunk->head, __put_chunk);
}

static void audit_tree_destroy_watch(struct fsnotify_mark *entry)
{
struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
call_rcu(&chunk->head, __put_chunk);
audit_mark_put_chunk(chunk);
}

static struct audit_chunk *alloc_chunk(int count)
Expand Down

0 comments on commit a837571

Please sign in to comment.