Commit 811c5ebf authored by zhangzl2013's avatar zhangzl2013 Committed by Evan Hunt
Browse files

Fix crash caused by race condition in timer creation

The race condition is the timer elapses before isc__timer_create()
returns the pointer to the caller.  Assigning the return pointer before
enabling the timer will fix it.

(cherry picked from commit 21966423)
parent cb7420f4
Pipeline #4930 passed with stages
in 8 minutes and 24 seconds
......@@ -474,8 +474,10 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
result = schedule(timer, &now, true);
result = ISC_R_SUCCESS;
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
*timerp = (isc_timer_t *)timer;
APPEND(manager->timers, timer, link);
......@@ -488,8 +490,6 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
return (result);
*timerp = (isc_timer_t *)timer;
return (ISC_R_SUCCESS);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment