Fix use-after-free in keepalive_timer and rework stop_client()

The bug reproduced if fio was temporarily stopped with SIGSTOP
during write test and then resumed after 10 seconds. In this case
"pings" were failed for all clients and fio process crashed with
'use-after-free' in keepalive_timer. It happened because it called
stop_client while having a live iterator to the map.
This commit is contained in:
Vitaliy Filippov
2021-04-07 11:06:31 +03:00
parent 97efb9e299
commit b0b2e7df3c
4 changed files with 81 additions and 64 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ void osd_messenger_t::handle_send(int result, osd_client_t *cl)
cl->refs--;
if (cl->peer_state == PEER_STOPPED)
{
if (!cl->refs)
if (cl->refs <= 0)
{
delete cl;
}