浏览代码

qcacld-3.0: Fix possible null pointer de-references in SME and WMA

Add null check to avoid null pointer de-references.

Change-Id: I8a93f269467bbb0dec5610ae158c4f5dc9658a12
CRs-Fixed: 2196080
Arif Hussain 7 年之前
父节点
当前提交
d15902ccd5
共有 2 个文件被更改,包括 17 次插入0 次删除
  1. 8 0
      core/sme/src/common/sme_api.c
  2. 9 0
      core/wma/src/wma_main.c

+ 8 - 0
core/sme/src/common/sme_api.c

@@ -16061,6 +16061,10 @@ int16_t sme_get_oper_chan_freq(struct wlan_objmgr_vdev *vdev)
 	}
 
 	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	if (!h_hal) {
+		sme_err("h_hal is null");
+		return 0;
+	}
 	mac_ctx = PMAC_STRUCT(h_hal);
 	vdev_id = wlan_vdev_get_id(vdev);
 	if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {
@@ -16090,6 +16094,10 @@ enum phy_ch_width sme_get_oper_ch_width(struct wlan_objmgr_vdev *vdev)
 	}
 
 	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	if (!h_hal) {
+		sme_err("h_hal is null");
+		return CH_WIDTH_INVALID;
+	}
 	mac_ctx = PMAC_STRUCT(h_hal);
 	vdev_id = wlan_vdev_get_id(vdev);
 	if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {

+ 9 - 0
core/wma/src/wma_main.c

@@ -2957,6 +2957,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 
 	/* initialize default target config */
 	wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_psoc_info);
+	if (!wlan_res_cfg) {
+		WMA_LOGE("%s: wlan_res_cfg is null", __func__);
+		qdf_status = QDF_STATUS_E_NOMEM;
+		goto err_wma_handle;
+	}
 
 	wma_set_default_tgt_config(wma_handle, wlan_res_cfg);
 
@@ -5185,6 +5190,10 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
 	}
 
 	wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl);
+	if (!wlan_res_cfg) {
+		WMA_LOGE("%s: wlan_res_cfg is null", __func__);
+		return;
+	}
 	service_ext_param =
 			target_psoc_get_service_ext_param(tgt_hdl);
 	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);