Skip to content
Commit 0e436ed7 authored by Vincent Wan's avatar Vincent Wan Committed by Jukka Rissanen
Browse files

lib: fdtable: fix reference counting in z_reserve_fd()



The new fd entry should be reserved by incrementing its reference count
in z_reserve_fd() instead of z_finalize_fd() in order to avoid having
the same one being returned in a concurrent call. If for some reason
the fd is not finalized after z_reserve_fd() is called, it can be
freed via z_free_fd(), which would decrement the reference count.

Fixes #27721

Signed-off-by: default avatarVincent Wan <vwan@ti.com>
parent 2ce87da2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment