From 74304e1a523a92470361ec6ea20ee7e9bc45659f Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Tue, 25 Jun 2024 14:53:07 +0200 Subject: [PATCH] regions_mm: Invalidate cache when freeing memory 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 --- zephyr/lib/regions_mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zephyr/lib/regions_mm.c b/zephyr/lib/regions_mm.c index f60f8875a1c9..2f04baaad232 100644 --- a/zephyr/lib/regions_mm.c +++ b/zephyr/lib/regions_mm.c @@ -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); + } /**