mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-07 06:42:48 +00:00
The sys_mem_pool implementation has a subtle error case where it detected a simultaneous allocation after having released the lock, in which case exactly one of the racing allocators will return with -EAGAIN (the other one suceeds of course). I documented this condition at the lower level, but forgot to actually handle it at the k_mem_pool level where we want to retry once before going to sleep, as it doesn't generally represent an empty heap. It got caught by code auditing in: https://github.com/zephyrproject-rtos/zephyr/issues/6757 (Full disclosure: I tested this by whiteboxing the first failure. I wasn't able to put together a rig to reliably exercise the actual race.) This patch also fixes a noop thinko in the return logic in the same function, which contained: (ret == -EAGAIN) || (ret && ret != -ENOMEM) The first term is needless and implied by the second. Signed-off-by: Andy Ross <andrew.j.ross@intel.com> |
||
---|---|---|
.. | ||
include | ||
alert.c | ||
atomic_c.c | ||
CMakeLists.txt | ||
compiler_stack_protect.c | ||
device.c | ||
errno.c | ||
idle.c | ||
init.c | ||
int_latency_bench.c | ||
Kconfig | ||
Kconfig.event_logger | ||
Kconfig.power_mgmt | ||
mailbox.c | ||
mem_domain.c | ||
mem_slab.c | ||
mempool.c | ||
msg_q.c | ||
mutex.c | ||
pipes.c | ||
poll.c | ||
queue.c | ||
sched.c | ||
sem.c | ||
smp.c | ||
stack.c | ||
sys_clock.c | ||
system_work_q.c | ||
thread_abort.c | ||
thread.c | ||
timer.c | ||
userspace_handler.c | ||
userspace.c | ||
version.c | ||
work_q.c |