You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the API of k_mem_pool_alloc should handle the -EAGAIN which is return value of pool_alloc.
at 271 line in mempool.c comments" -EAGAIN isn't for,propagation to the caller, it's to tell the loop in k_mem_pool_alloc() to try again synchronously."but the k_mem_pool_alloc does not handle loop.
by xuemingxing .xuemingxing@zte.com.cn
The text was updated successfully, but these errors were encountered:
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:
zephyrproject-rtos#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>
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:
#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>
the API of k_mem_pool_alloc should handle the -EAGAIN which is return value of pool_alloc.
at 271 line in mempool.c comments" -EAGAIN isn't for,propagation to the caller, it's to tell the loop in k_mem_pool_alloc() to try again synchronously."but the k_mem_pool_alloc does not handle loop.
by xuemingxing .xuemingxing@zte.com.cn
The text was updated successfully, but these errors were encountered: