summaryrefslogtreecommitdiff
path: root/security/apparmor/include/policy_ns.h
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 00:42:22 -0800
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 01:18:20 -0800
commit9a2d40c12d00ead1b1a3ac8383d2d66e35674fdb (patch)
treee4642a3eff6031dc30d58ea4263a5bb49accffef /security/apparmor/include/policy_ns.h
parent1741e9eb8c15de0ba6598a342c51d0688cb569d2 (diff)
apparmor: add strn version of aa_find_ns
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/include/policy_ns.h')
-rw-r--r--security/apparmor/include/policy_ns.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/security/apparmor/include/policy_ns.h b/security/apparmor/include/policy_ns.h
index 323752cc0c87..381f8b078548 100644
--- a/security/apparmor/include/policy_ns.h
+++ b/security/apparmor/include/policy_ns.h
@@ -82,6 +82,7 @@ void aa_free_root_ns(void);
void aa_free_ns_kref(struct kref *kref);
struct aa_ns *aa_find_ns(struct aa_ns *root, const char *name);
+struct aa_ns *aa_findn_ns(struct aa_ns *root, const char *name, size_t n);
struct aa_ns *aa_prepare_ns(const char *name);
void __aa_remove_ns(struct aa_ns *ns);
@@ -119,18 +120,24 @@ static inline void aa_put_ns(struct aa_ns *ns)
}
/**
- * __aa_find_ns - find a namespace on a list by @name
+ * __aa_findn_ns - find a namespace on a list by @name
* @head: list to search for namespace on (NOT NULL)
* @name: name of namespace to look for (NOT NULL)
- *
+ * @n: length of @name
* Returns: unrefcounted namespace
*
* Requires: rcu_read_lock be held
*/
+static inline struct aa_ns *__aa_findn_ns(struct list_head *head,
+ const char *name, size_t n)
+{
+ return (struct aa_ns *)__policy_strn_find(head, name, n);
+}
+
static inline struct aa_ns *__aa_find_ns(struct list_head *head,
const char *name)
{
- return (struct aa_ns *)__policy_find(head, name);
+ return __aa_findn_ns(head, name, strlen(name));
}
#endif /* AA_NAMESPACE_H */