Skip to content

Commit 98482e3

Browse files
committed
fast-get: fix a recent regression
Recent commits 7d0621e ("fast-get: fix partition leak for multi-thread usage") and 3c757dd ("fast-get: fix crash by freeing buffer before removing partition") introduced a regression when using SRC in DP mode in userspace on PTL and running two aplay -r 44100 back to back. The reason is that SRC isn't calling mod_fast_put() explicitly and is instead relying on automatic clean up, which then happens in a different thread. In fact those two commits weren't needed AFAICS, since fast_put() shouldn't be called directly from userspace, instead only mod_fast_put() should be called, which is a syscall, and therefore fast_put() then will have access to all the memory. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 04b2d16 commit 98482e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

zephyr/lib/fast-get.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ void fast_put(struct k_heap *heap, const void *sram_ptr)
300300
.size = ALIGN_UP(entry->size, CONFIG_MM_DRV_PAGE_SIZE),
301301
.attr = K_MEM_PARTITION_P_RO_U_RO | XTENSA_MMU_CACHED_WB,
302302
};
303-
struct k_mem_domain *domain = k_current_get()->mem_domain_info.mem_domain;
303+
struct k_mem_domain *domain = entry->thread->mem_domain_info.mem_domain;
304304

305305
LOG_DBG("removing partition %p size %#zx from thread %p",
306-
(void *)part.start, part.size, k_current_get());
306+
(void *)part.start, part.size, entry->thread);
307307
int err = k_mem_domain_remove_partition(domain, &part);
308308

309309
if (err)

0 commit comments

Comments
 (0)