]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - security/apparmor/policy.c
Merge branch 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
[karo-tx-linux.git] / security / apparmor / policy.c
index bc63cf7b606add99370ebcf2d370f74461de1f23..f44312a19522b6fd1e83a877c6e3557500d1a127 100644 (file)
@@ -99,7 +99,6 @@ const char *const aa_profile_mode_names[] = {
        "unconfined",
 };
 
-
 /* requires profile list write lock held */
 void __aa_update_proxy(struct aa_profile *orig, struct aa_profile *new)
 {
@@ -194,6 +193,20 @@ void aa_free_proxy_kref(struct kref *kref)
        free_proxy(p);
 }
 
+/**
+ * aa_free_data - free a data blob
+ * @ptr: data to free
+ * @arg: unused
+ */
+static void aa_free_data(void *ptr, void *arg)
+{
+       struct aa_data *data = ptr;
+
+       kzfree(data->data);
+       kzfree(data->key);
+       kzfree(data);
+}
+
 /**
  * aa_free_profile - free a profile
  * @profile: the profile to free  (MAYBE NULL)
@@ -206,6 +219,8 @@ void aa_free_proxy_kref(struct kref *kref)
  */
 void aa_free_profile(struct aa_profile *profile)
 {
+       struct rhashtable *rht;
+
        AA_DEBUG("%s(%p)\n", __func__, profile);
 
        if (!profile)
@@ -227,6 +242,13 @@ void aa_free_profile(struct aa_profile *profile)
        aa_put_dfa(profile->policy.dfa);
        aa_put_proxy(profile->proxy);
 
+       if (profile->data) {
+               rht = profile->data;
+               profile->data = NULL;
+               rhashtable_free_and_destroy(rht, aa_free_data, NULL);
+               kzfree(rht);
+       }
+
        kzfree(profile->hash);
        aa_put_loaddata(profile->rawdata);
        kzfree(profile);