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

Commit f2d25e3e authored by Laura Abbott's avatar Laura Abbott
Browse files

ion: Use dma_free_attrs for freeing secure memory



Secure CMA memory is allocated using DMA_ATTR_NO_KERNEL_MAPPING.
Free the memory with the same attribute.

Change-Id: I67289af68763c5b6d4b0f3d828174ad28b711642
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent 0e3d68ed
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -319,11 +319,14 @@ out:
static void ion_secure_cma_free_chunk(struct ion_cma_secure_heap *sheap,
					struct ion_cma_alloc_chunk *chunk)
{
	DEFINE_DMA_ATTRS(attrs);

	dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs);
	/* This region is 'allocated' and not available to allocate from */
	bitmap_set(sheap->bitmap, (chunk->handle - sheap->base) >> PAGE_SHIFT,
			chunk->chunk_size >> PAGE_SHIFT);
	dma_free_coherent(sheap->dev, chunk->chunk_size, chunk->cpu_addr,
				chunk->handle);
	dma_free_attrs(sheap->dev, chunk->chunk_size, chunk->cpu_addr,
				chunk->handle, &attrs);
	atomic_sub(chunk->chunk_size, &sheap->total_pool_size);
	list_del(&chunk->entry);
	kfree(chunk);