diff --git a/umac/cmn_services/serialization/src/wlan_serialization_main.c b/umac/cmn_services/serialization/src/wlan_serialization_main.c index a6ece3d83193..7877376bce95 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_main.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_main.c @@ -52,11 +52,12 @@ QDF_STATUS wlan_serialization_psoc_disable(struct wlan_objmgr_psoc *psoc) if (status != QDF_STATUS_SUCCESS) ser_err("ser cleanning up all timer failed"); + /* Use lock to free to avoid any race where timer is still in use */ + wlan_serialization_acquire_lock(&ser_soc_obj->timer_lock); qdf_mem_free(ser_soc_obj->timers); ser_soc_obj->timers = NULL; ser_soc_obj->max_active_cmds = 0; - - wlan_serialization_destroy_lock(&ser_soc_obj->timer_lock); + wlan_serialization_release_lock(&ser_soc_obj->timer_lock); error: return status; } @@ -87,7 +88,6 @@ QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc) goto error; } - wlan_serialization_create_lock(&ser_soc_obj->timer_lock); status = QDF_STATUS_SUCCESS; error: @@ -127,6 +127,7 @@ static QDF_STATUS wlan_serialization_psoc_create_handler( ser_err("Obj attach failed"); goto error; } + wlan_serialization_create_lock(&soc_ser_obj->timer_lock); ser_debug("ser psoc obj created"); status = QDF_STATUS_SUCCESS; @@ -331,6 +332,7 @@ wlan_serialization_psoc_destroy_handler(struct wlan_objmgr_psoc *psoc, if (status != QDF_STATUS_SUCCESS) ser_err("ser psoc private obj detach failed"); + wlan_serialization_destroy_lock(&ser_soc_obj->timer_lock); ser_debug("ser psoc obj deleted with status %d", status); qdf_mem_free(ser_soc_obj);