From 479b0d31a18f936b5587ee5cb527a125d610a5ab Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Thu, 23 Sep 2021 13:51:13 +0530 Subject: [PATCH] qcacmn: Fix the issues pointed out by KW in the regulatory module Fix the issues pointed out by KW : 1) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html# issuedetails_goto:problemid=222576,project=CRM_NHSS_QSDK_11_5_P Initialize dbg_id in reg_process_afc_power_event. 2) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html# issuedetails_goto:problemid=222579,project=CRM_NHSS_QSDK_11_5_P In ucfg_reg_get_partial_afc_req_info, add a sanity check for afc_req to prevent NULL pointer dereference. 3) https://kwdbprod16.qualcomm.com:8070/review/insight-review.html# issuedetails_goto:problemid=222580,project=CRM_NHSS_QSDK_11_5_P Add a sanity check for afc_chan_obj to prevent NULL pointer dereference. Change-Id: I0481fda6d08590312a863a33a1823a0b07fa194e CRs-Fixed: 3043280 --- umac/regulatory/core/src/reg_build_chan_list.c | 5 +++++ umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c | 6 +++++- wmi/src/wmi_unified_tlv.c | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index 1f6bc19575..eade4a4d67 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -2929,6 +2929,11 @@ reg_process_afc_power_event(struct afc_regulatory_info *afc_info) else pdev_id = phy_id; + if (soc_reg->offload_enabled) + dbg_id = WLAN_REGULATORY_NB_ID; + else + dbg_id = WLAN_REGULATORY_SB_ID; + reg_debug("process reg afc master chan list"); this_mchan_params = &soc_reg->mas_chan_params[phy_id]; afc_mas_chan_list = this_mchan_params->mas_chan_list_6g_afc; diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 91c97f53d1..8392b22c43 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -265,7 +265,11 @@ QDF_STATUS ucfg_reg_get_partial_afc_req_info( QDF_STATUS status; status = reg_get_partial_afc_req_info(pdev, afc_req); - if (status == QDF_STATUS_SUCCESS && afc_req) + + if (!afc_req) + return QDF_STATUS_E_NOMEM; + + if (status == QDF_STATUS_SUCCESS) reg_dmn_set_afc_req_id(*afc_req, req_id); return status; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 7f4876de05..174b562eea 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -13132,6 +13132,9 @@ static void copy_power_event(struct afc_regulatory_info *afc_info, afc_chan_info = qdf_mem_malloc(power_info->num_chan_objs * sizeof(*afc_chan_info)); + if (!afc_chan_info) + return; + copy_afc_chan_obj_info(afc_chan_info, power_info->num_chan_objs, channel_info_hdr,