Skip to content

Commit a837571

Browse files
jankarapcmoore
authored andcommitted
audit: Provide helper for dropping mark's chunk reference
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>
1 parent 8cd0feb commit a837571

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎kernel/audit_tree.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,20 @@ static void __put_chunk(struct rcu_head *rcu)
132132
audit_put_chunk(chunk);
133133
}
134134

135+
/*
136+
* Drop reference to the chunk that was held by the mark. This is the reference
137+
* that gets dropped after we've removed the chunk from the hash table and we
138+
* use it to make sure chunk cannot be freed before RCU grace period expires.
139+
*/
140+
static void audit_mark_put_chunk(struct audit_chunk *chunk)
141+
{
142+
call_rcu(&chunk->head, __put_chunk);
143+
}
144+
135145
static void audit_tree_destroy_watch(struct fsnotify_mark *entry)
136146
{
137147
struct audit_chunk *chunk = container_of(entry, struct audit_chunk, mark);
138-
call_rcu(&chunk->head, __put_chunk);
148+
audit_mark_put_chunk(chunk);
139149
}
140150

141151
static struct audit_chunk *alloc_chunk(int count)

0 commit comments

Comments
 (0)