Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race in
tfw_sock_srv_disconnect
.
There was a race between `tfw_sock_srv_disconnect` and `tfw_srv_conn_release` when last one is called from `ss_conn_drop_guard_exit` when we process FIN from remote peer. Connection can be released after we check that connection refcount is not equal to TFW_CONN_DEATHCNT and before we call `tfw_connection_close`. Later we increment connection reference counter (for already stopped connection, which is equal to zero) and put it again. This leads to second connection release and extra decrement of struct server reference counter. We need to call `__tfw_connection_get_if_live` instead of simple check that connection reference counter is not equal to TFW_CONN_DEATHCNT before connection closing. Closes #2047 #2054
- Loading branch information