You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/02/27 18:28:07 UTC
[trafficserver] branch 9.0.x updated: Fix code to avoid
HostDBContinuation use after free
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 153c081 Fix code to avoid HostDBContinuation use after free
153c081 is described below
commit 153c08166ed3ba83f92064e607b37210fa34c297
Author: Susan Hinrichs <sh...@oath.com>
AuthorDate: Fri Sep 20 18:00:28 2019 +0000
Fix code to avoid HostDBContinuation use after free
(cherry picked from commit f27f90dd0f1eb38b5c4e2094f1710536d9a32682)
---
iocore/hostdb/HostDB.cc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 512781f..2ee0e22 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1178,8 +1178,9 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
if (event == EVENT_INTERVAL) {
if (!action.continuation) {
// give up on insert, it has been too long
+ // remove_trigger_pending_dns will notify and clean up all requests
+ // including this one.
remove_trigger_pending_dns();
- hostdb_cont_free(this);
return EVENT_DONE;
}
MUTEX_TRY_LOCK(lock, action.mutex, thread);
@@ -1434,18 +1435,18 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
}
}
if (need_to_reschedule) {
- remove_trigger_pending_dns();
SET_HANDLER((HostDBContHandler)&HostDBContinuation::probeEvent);
- thread->schedule_in(this, HOST_DB_RETRY_PERIOD);
+ // remove_trigger_pending_dns should kick off the current hostDB too
+ // No need to explicitly reschedule
+ remove_trigger_pending_dns();
return EVENT_CONT;
}
}
// wake up everyone else who is waiting
remove_trigger_pending_dns();
- // all done
+ // all done, or at least scheduled to be all done
//
- hostdb_cont_free(this);
return EVENT_DONE;
}
}