mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
ion: Ensure secure HLOS accessible buffers are zeroed when allocated
Memory that is either pooled or permanently assigned to other VMIDs is not always cleared when it is released back into the pools. This is problematic when the memory is assigned such that HLOS can still access the memory, as a userspace process can reallocate the same buffer, and read data from when the buffer was previously allocated. Thus, clear secure ION buffers before freeing them, if they are HLOS accessible. Change-Id: Iaae14fc32b10e0c6afca007a5ee78aacd5e013e6 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
90e8284897
commit
3d85b42ad1
2 changed files with 3 additions and 1 deletions
|
|
@ -379,6 +379,8 @@ static void ion_sc_heap_free(struct ion_buffer *buffer)
|
|||
return;
|
||||
}
|
||||
|
||||
if (hlos_accessible_buffer(buffer))
|
||||
ion_buffer_zero(buffer);
|
||||
ion_carveout_free(child, paddr, buffer->size);
|
||||
sg_free_table(table);
|
||||
kfree(table);
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ void ion_system_heap_free(struct ion_buffer *buffer)
|
|||
|
||||
if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE) &&
|
||||
!(buffer->flags & ION_FLAG_POOL_FORCE_ALLOC)) {
|
||||
if (vmid < 0)
|
||||
if (hlos_accessible_buffer(buffer))
|
||||
ion_buffer_zero(buffer);
|
||||
} else if (vmid > 0) {
|
||||
if (ion_hyp_unassign_sg(table, &vmid, 1, true))
|
||||
|
|
|
|||
Loading…
Reference in a new issue