Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8651e1d6 authored by John Johansen's avatar John Johansen
Browse files

apparmor: make free_profile available outside of policy.c

parent 742058b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -228,6 +228,7 @@ struct aa_namespace *aa_find_namespace(struct aa_namespace *root,
void aa_free_replacedby_kref(struct kref *kref);
void aa_free_replacedby_kref(struct kref *kref);
struct aa_profile *aa_alloc_profile(const char *name);
struct aa_profile *aa_alloc_profile(const char *name);
struct aa_profile *aa_new_null_profile(struct aa_profile *parent, int hat);
struct aa_profile *aa_new_null_profile(struct aa_profile *parent, int hat);
void aa_free_profile(struct aa_profile *profile);
void aa_free_profile_kref(struct kref *kref);
void aa_free_profile_kref(struct kref *kref);
struct aa_profile *aa_find_child(struct aa_profile *parent, const char *name);
struct aa_profile *aa_find_child(struct aa_profile *parent, const char *name);
struct aa_profile *aa_lookup_profile(struct aa_namespace *ns, const char *name);
struct aa_profile *aa_lookup_profile(struct aa_namespace *ns, const char *name);
+4 −5
Original line number Original line Diff line number Diff line
@@ -307,7 +307,6 @@ static struct aa_namespace *alloc_namespace(const char *prefix,
	return NULL;
	return NULL;
}
}


static void free_profile(struct aa_profile *profile);
/**
/**
 * free_namespace - free a profile namespace
 * free_namespace - free a profile namespace
 * @ns: the namespace to free  (MAYBE NULL)
 * @ns: the namespace to free  (MAYBE NULL)
@@ -324,7 +323,7 @@ static void free_namespace(struct aa_namespace *ns)
	aa_put_namespace(ns->parent);
	aa_put_namespace(ns->parent);


	ns->unconfined->ns = NULL;
	ns->unconfined->ns = NULL;
	free_profile(ns->unconfined);
	aa_free_profile(ns->unconfined);
	kzfree(ns);
	kzfree(ns);
}
}


@@ -568,7 +567,7 @@ void aa_free_replacedby_kref(struct kref *kref)
}
}


/**
/**
 * free_profile - free a profile
 * aa_free_profile - free a profile
 * @profile: the profile to free  (MAYBE NULL)
 * @profile: the profile to free  (MAYBE NULL)
 *
 *
 * Free a profile, its hats and null_profile. All references to the profile,
 * Free a profile, its hats and null_profile. All references to the profile,
@@ -577,7 +576,7 @@ void aa_free_replacedby_kref(struct kref *kref)
 * If the profile was referenced from a task context, free_profile() will
 * If the profile was referenced from a task context, free_profile() will
 * be called from an rcu callback routine, so we must not sleep here.
 * be called from an rcu callback routine, so we must not sleep here.
 */
 */
static void free_profile(struct aa_profile *profile)
void aa_free_profile(struct aa_profile *profile)
{
{
	AA_DEBUG("%s(%p)\n", __func__, profile);
	AA_DEBUG("%s(%p)\n", __func__, profile);


@@ -612,7 +611,7 @@ static void aa_free_profile_rcu(struct rcu_head *head)
	if (p->flags & PFLAG_NS_COUNT)
	if (p->flags & PFLAG_NS_COUNT)
		free_namespace(p->ns);
		free_namespace(p->ns);
	else
	else
		free_profile(p);
		aa_free_profile(p);
}
}


/**
/**
+2 −2
Original line number Original line Diff line number Diff line
@@ -616,7 +616,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e)
	else if (!name)
	else if (!name)
		name = "unknown";
		name = "unknown";
	audit_iface(profile, name, "failed to unpack profile", e, error);
	audit_iface(profile, name, "failed to unpack profile", e, error);
	aa_put_profile(profile);
	aa_free_profile(profile);


	return ERR_PTR(error);
	return ERR_PTR(error);
}
}
@@ -763,7 +763,7 @@ int aa_unpack(void *udata, size_t size, struct list_head *lh, const char **ns)


		error = verify_profile(profile);
		error = verify_profile(profile);
		if (error) {
		if (error) {
			aa_put_profile(profile);
			aa_free_profile(profile);
			goto fail;
			goto fail;
		}
		}