Attention is currently required from: Lance Zhao, Konrad Adamczyk, Jakub Czapiga, Tim Wawrzynczak, Grzegorz Bernacki, Karthik Ramasubramanian.
Tim Van Patten has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/74715 )
Change subject: acpi: Add missing cbfs_unmap() ......................................................................
Patch Set 2:
(1 comment)
File src/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/74715/comment/db262c16_bdcb2ce9 PS2, Line 1934: cbfs_unmap(dsdt_file); This call doesn't actually free the memory. Instead, these `cbfs_unmap()` calls need to be reversed, since the memory must be freed in reverse order of how it was allocated.
Looking at the implementation of `cbfs_unmap()`, it just calls `mem_pool_free()`:
`src/third_party/coreboot/src/lib/cbfs.c` ``` void cbfs_unmap(void *mapping) { ... mem_pool_free(&cbfs_cache, mapping); } ```
However, `mem_pool_free()` will only free the last allocation, which in this case was `slic_file`.
`src/third_party/coreboot/src/commonlib/mem_pool.c` ``` void mem_pool_free(struct mem_pool *mp, void *p) { /* Determine if p was the most recent allocation. */ if (p == NULL || mp->last_alloc != p) <<---- last_alloc == slic_file return;
mp->free_offset = mp->last_alloc - mp->buf; mp->last_alloc = mp->second_to_last_alloc; /* No way to track allocation before this one. */ mp->second_to_last_alloc = NULL; } ```