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

Commit 6d88d827 authored by Laura Abbott's avatar Laura Abbott
Browse files

gpu: ion: Skip wrong usage check for secure buffers



With the change to secure buffers at allocation time, it is
no longer possible to correctly validate if the memory is
re-secured with a different usage hint. Considering the usage
hint is being deprecated anyway, drop the redundant check. If
a client tries to re-secure with the wrong usage hint, failures
will occur elsewhere to indicate the problem.

Change-Id: If8487c431eb4555927cd06c6cc5edcb1a66002f1
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent d6e87cbf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ static int ion_secure_cma_allocate(struct ion_heap *heap,
	if (buf) {
		int ret;

		ret = msm_ion_secure_table(buf->table, 0, 0, true);
		ret = msm_ion_secure_table(buf->table, 0, 0);
		if (ret) {
			/*
			 * Don't treat the secure buffer failing here as an
+2 −2
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ int ion_cp_secure_buffer(struct ion_buffer *buffer, int version, void *data,
int ion_cp_unsecure_buffer(struct ion_buffer *buffer, int force_unsecure);

int msm_ion_secure_table(struct sg_table *table, enum cp_mem_usage usage,
			int flags, bool skip_usage);
			int flags);

int msm_ion_unsecure_table(struct sg_table *table);

@@ -114,7 +114,7 @@ static inline int ion_cp_unsecure_buffer(struct ion_buffer *buffer,
}

int msm_ion_secure_table(struct sg_table *table, enum cp_mem_usage usage,
			int flags, bool skip_usage)
			int flags)
{
	return -ENODEV;
}
+2 −11
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static int secure_buffer_change_table(struct sg_table *table,
}

int msm_ion_secure_table(struct sg_table *table, enum cp_mem_usage usage,
			int flags, bool skip_usage_check)
			int flags)
{
	struct secure_meta *meta;
	int ret;
@@ -184,15 +184,6 @@ int msm_ion_secure_table(struct sg_table *table, enum cp_mem_usage usage,
	meta = secure_meta_lookup(table);

	if (meta) {
		if (meta->usage != usage && !skip_usage_check) {
			pr_err("%s: Trying to re-secure buffer with different values",
				__func__);
			pr_err("Last secured usage: %d current %d\n",
				meta->usage, usage);
			ret = -EINVAL;
			goto out;
		}

		kref_get(&meta->ref);
		ret = 0;
	} else {
@@ -233,7 +224,7 @@ int msm_ion_secure_buffer(struct ion_client *client, struct ion_handle *handle,
		goto out;
	}

	ret = msm_ion_secure_table(table, usage, flags, false);
	ret = msm_ion_secure_table(table, usage, flags);
out:
	return ret;
}