commit | 0e436ed72ab142285978dac89aebf5df2ec23f40 | [log] [tgz] |
---|---|---|
author | Vincent Wan <vwan@ti.com> | Fri Aug 21 14:37:39 2020 -0700 |
committer | Jukka Rissanen <jukka.rissanen+github@gmail.com> | Thu Aug 27 11:42:19 2020 +0300 |
tree | 8abc051cdd9b97fa2a54f74f3bdc6ffb1a587bbf | |
parent | 2ce87da252da7edca436046eede433a2ff380f27 [diff] |
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: Vincent Wan <vwan@ti.com>