Browse Source

qcacld-3.0: Revert the change for cleanup qdf list

wma_vdev_find_req will remove the request from queue if found it. If
remove the request when peek it, then wma_vdev_find_req fail and memory
leak happens. The change for cleanup qdf list is for NULL mac_ctx case.
Solution is revert previous change and move mac_ctx checker back.

Change-Id: I06deedaf9f8a3c788621d8468e00d4d4852e2d9f
CRs-Fixed: 2090051
Wu Gao 7 years ago
parent
commit
30f65eb90b
2 changed files with 14 additions and 9 deletions
  1. 10 7
      core/wma/src/wma_dev_if.c
  2. 4 2
      core/wma/src/wma_main.c

+ 10 - 7
core/wma/src/wma_dev_if.c

@@ -2855,13 +2855,7 @@ void wma_vdev_resp_timer(void *data)
 	void *peer;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
-	tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
-
-	if (NULL == mac_ctx) {
-		WMA_LOGE("%s: Failed to get mac_ctx", __func__);
-		wma_cleanup_target_req_param(tgt_req);
-		goto free_tgt_req;
-	}
+	tpAniSirGlobal mac_ctx;
 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
@@ -2892,6 +2886,15 @@ void wma_vdev_resp_timer(void *data)
 		goto free_tgt_req;
 	}
 
+#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
+	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	if (!mac_ctx) {
+		WMA_LOGE("%s: Failed to get mac_ctx", __func__);
+		wma_cleanup_target_req_param(tgt_req);
+		goto free_tgt_req;
+	}
+#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
+
 	if (tgt_req->msg_type == WMA_CHNL_SWITCH_REQ) {
 		tpSwitchChannelParams params =
 			(tpSwitchChannelParams) tgt_req->user_data;

+ 4 - 2
core/wma/src/wma_main.c

@@ -1796,7 +1796,8 @@ static void wma_cleanup_vdev_resp_queue(tp_wma_handle wma)
 		return;
 	}
 
-	while (qdf_list_remove_front(&wma->vdev_resp_queue, &node1) ==
+	/* peek front, and then cleanup it in wma_vdev_resp_timer */
+	while (qdf_list_peek_front(&wma->vdev_resp_queue, &node1) ==
 				   QDF_STATUS_SUCCESS) {
 		req_msg = qdf_container_of(node1, struct wma_target_req, node);
 		qdf_spin_unlock_bh(&wma->vdev_respq_lock);
@@ -1825,8 +1826,9 @@ static void wma_cleanup_hold_req(tp_wma_handle wma)
 		return;
 	}
 
+	/* peek front, and then cleanup it in wma_hold_req_timer */
 	while (QDF_STATUS_SUCCESS ==
-		qdf_list_remove_front(&wma->wma_hold_req_queue, &node1)) {
+		qdf_list_peek_front(&wma->wma_hold_req_queue, &node1)) {
 		req_msg = qdf_container_of(node1, struct wma_target_req, node);
 		qdf_spin_unlock_bh(&wma->wma_hold_req_q_lock);
 		/* Cleanup timeout handler */