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

Commit 8eae5b79 authored by Liam Mark's avatar Liam Mark
Browse files

ion: Ensure correct heap type set during heap drain



Since process_one_shrink is attempting to make a secure allocation
correctly set the heap type to system secure heap and not system heap
type.

This is now required since we validate the buffer heap type when the
allocation is processed.

Without this change the allocation will fail as it is attempting to do a
secure allocation from the system heap.

Change-Id: I54fbc2bc6477b47f8e4e92e797b27840d42dde79
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
parent b1a1a12b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -160,7 +160,8 @@ size_t ion_system_secure_heap_page_pool_total(struct ion_heap *heap,
	return total << PAGE_SHIFT;
}

static void process_one_shrink(struct ion_heap *sys_heap,
static void process_one_shrink(struct ion_system_secure_heap *secure_heap,
			       struct ion_heap *sys_heap,
			       struct prefetch_info *info)
{
	struct ion_buffer buffer;
@@ -168,7 +169,7 @@ static void process_one_shrink(struct ion_heap *sys_heap,
	int ret;

	memset(&buffer, 0, sizeof(struct ion_buffer));
	buffer.heap = sys_heap;
	buffer.heap = &secure_heap->heap;
	buffer.flags = info->vmid;

	pool_size = ion_system_secure_heap_page_pool_total(sys_heap,
@@ -182,6 +183,7 @@ static void process_one_shrink(struct ion_heap *sys_heap,
	}

	buffer.private_flags = ION_PRIV_FLAG_SHRINKER_FREE;
	buffer.heap = sys_heap;
	sys_heap->ops->free(&buffer);
}

@@ -201,7 +203,7 @@ static void ion_system_secure_heap_prefetch_work(struct work_struct *work)
		spin_unlock_irqrestore(&secure_heap->work_lock, flags);

		if (info->shrink)
			process_one_shrink(sys_heap, info);
			process_one_shrink(secure_heap, sys_heap, info);
		else
			process_one_prefetch(sys_heap, info);