diff options
author | John Johansen <john.johansen@canonical.com> | 2017-01-16 00:42:40 -0800 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2017-01-16 01:18:32 -0800 |
commit | 293a4886f93f1d4f01ef2642b81c2509a5376ce5 (patch) | |
tree | e09608c8f8de46c9b86937f32b7373a153d14020 /security | |
parent | 474d6b75106229025ab6b7bbabf2f9c246e928e1 (diff) |
apparmor: add get_dfa() fn
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 <john.johansen@canonical.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/include/match.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h index a1c04fe86790..d751c8bf72cd 100644 --- a/security/apparmor/include/match.h +++ b/security/apparmor/include/match.h @@ -128,6 +128,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) * |