瀏覽代碼

qcacld-3.1: Fix NULL pointer dereference

API is trying to access the wmi descriptor
even though it is failed to allocate.

- Add a NULL pointer verification check before
  accessing the wmi descriptor.
- Return failure to UMAC if the wmi failed to
provide the wmi descriptor.

Change-Id: I1ca8670c43e795d874d4e57bca8577b5fb90468a
CRs-Fixed: 1009636
Sandeep Puligilla 9 年之前
父節點
當前提交
eca12f2624
共有 1 個文件被更改,包括 11 次插入6 次删除
  1. 11 6
      core/wma/src/wma_data.c

+ 11 - 6
core/wma/src/wma_data.c

@@ -2718,14 +2718,19 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 		mgmt_param.tx_complete_cb = tx_frm_download_comp_cb;
 		mgmt_param.tx_ota_post_proc_cb = tx_frm_ota_comp_cb;
 		mgmt_param.chanfreq = chanfreq;
-		mgmt_param.wmi_desc = wmi_desc_get(wma_handle);
 		mgmt_param.pdata = pData;
 		mgmt_param.qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
-
-		status = wmi_mgmt_unified_cmd_send(wma_handle->wmi_handle,
-					&mgmt_param);
-		if (status)
-			wmi_desc_put(wma_handle, mgmt_param.wmi_desc);
+		mgmt_param.wmi_desc = wmi_desc_get(wma_handle);
+		if (NULL == mgmt_param.wmi_desc) {
+			WMA_LOGE(FL("Failed to get wmi descriptor"));
+			status = QDF_STATUS_E_FAILURE;
+		} else {
+			status = wmi_mgmt_unified_cmd_send(
+						wma_handle->wmi_handle,
+						&mgmt_param);
+			if (status)
+				wmi_desc_put(wma_handle, mgmt_param.wmi_desc);
+		}
 	} else {
 		/* Hand over the Tx Mgmt frame to TxRx */
 		status = ol_txrx_mgmt_send_ext(txrx_vdev, tx_frame,