Skip to content

Commit

Permalink
regions_mm: Invalidate cache when freeing memory
Browse files Browse the repository at this point in the history
A memory region may be allocated to a different core than before, and
performing a writeback by the cache may corrupt the current data.

Signed-off-by: Adrian Warecki <[email protected]>
  • Loading branch information
softwarecki committed Jun 25, 2024
1 parent 400bcd5 commit 74304e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zephyr/lib/regions_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,10 @@ int vmh_free(struct vmh_heap *heap, void *ptr)
if (retval)
return retval;

sys_cache_data_invd_range(ptr, size_to_free);
return vmh_unmap_region(heap->physical_blocks_allocators[mem_block_iter], ptr,
size_to_free);

}

/**
Expand Down

0 comments on commit 74304e1

Please sign in to comment.