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
This commit is contained in:
Arif Hussain
2018-03-02 00:08:29 -08:00
committed by nshrivas
parent 06259e5d96
commit d15902ccd5
2 changed files with 17 additions and 0 deletions

View File

@@ -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); 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); mac_ctx = PMAC_STRUCT(h_hal);
vdev_id = wlan_vdev_get_id(vdev); vdev_id = wlan_vdev_get_id(vdev);
if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { 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); 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); mac_ctx = PMAC_STRUCT(h_hal);
vdev_id = wlan_vdev_get_id(vdev); vdev_id = wlan_vdev_get_id(vdev);
if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) { if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {

View File

@@ -2957,6 +2957,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
/* initialize default target config */ /* initialize default target config */
wlan_res_cfg = target_psoc_get_wlan_res_cfg(tgt_psoc_info); 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); 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); 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 = service_ext_param =
target_psoc_get_service_ext_param(tgt_hdl); target_psoc_get_service_ext_param(tgt_hdl);
wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl); wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);