Commit 21966423 authored by zhangzl2013's avatar zhangzl2013 Committed by Michał Kępień
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.
parent 37e834de
Pipeline #4923 passed with stages
in 7 minutes and 49 seconds
......@@ -398,8 +398,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);
......@@ -412,8 +414,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