Skip to content

Commit

Permalink
apparmor: add get_dfa() fn
Browse files Browse the repository at this point in the history
The dfa is currently setup to be shared (has the basis of refcounting)
but currently can't be because the count can't be increased.

Signed-off-by: John Johansen <[email protected]>
  • Loading branch information
John Johansen committed Jan 16, 2017
1 parent 474d6b7 commit 293a488
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions security/apparmor/include/match.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ unsigned int aa_dfa_next(struct aa_dfa *dfa, unsigned int state,

void aa_dfa_free_kref(struct kref *kref);

/**
* aa_get_dfa - increment refcount on dfa @p
* @dfa: dfa (MAYBE NULL)
*
* Returns: pointer to @dfa if @dfa is NULL will return NULL
* Requires: @dfa must be held with valid refcount when called
*/
static inline struct aa_dfa *aa_get_dfa(struct aa_dfa *dfa)
{
if (dfa)
kref_get(&(dfa->count));

return dfa;
}

/**
* aa_put_dfa - put a dfa refcount
* @dfa: dfa to put refcount (MAYBE NULL)
Expand Down

0 comments on commit 293a488

Please sign in to comment.