浏览代码

qcacmn: In serialization timeout timer avoid double free

In serialization timeout timer, do not free memory before removing the
cmd from serialization queue. Free only if command is not found in the
queue.

Change-Id: I775b4230f2cb558142a13cfe0a339f3a20a04a33
CRs-Fixed: 2029599
Naveen Rawat 8 年之前
父节点
当前提交
d1f1484105
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      umac/cmn_services/serialization/src/wlan_serialization_utils.c

+ 5 - 4
umac/cmn_services/serialization/src/wlan_serialization_utils.c

@@ -156,20 +156,21 @@ static void wlan_serialization_generic_timer_callback(void *arg)
 	}
 
 	serialization_err("active command timeout for cmd_id[%d]", cmd->cmd_id);
-	if (cmd->cmd_cb) {
+	if (cmd->cmd_cb)
 		cmd->cmd_cb(cmd, WLAN_SER_CB_ACTIVE_CMD_TIMEOUT);
-		cmd->cmd_cb(cmd, WLAN_SER_CB_RELEASE_MEM_CMD);
-	}
 
 	serialization_err("active command timeout for cmd_id[%d]", cmd->cmd_id);
 	if (cmd->cmd_type >= WLAN_SER_CMD_NONSCAN)
 		QDF_BUG(0);
 	/*
 	 * dequeue cmd API will cleanup and destroy the timer. If it fails to
-	 * dequeue command then we have to destroy the timer.
+	 * dequeue command then we have to destroy the timer. It will also call
+	 * cmd callback with WLAN_SER_CB_RELEASE_MEM_CMD to free the memory.
 	 */
 	if (WLAN_SER_CMD_NOT_FOUND == wlan_serialization_dequeue_cmd(cmd, true))
 		wlan_serialization_timer_destroy(timer);
+	if (cmd->cmd_cb)
+		cmd->cmd_cb(cmd, WLAN_SER_CB_RELEASE_MEM_CMD);
 }
 
 /**