qcacld-3.0: Check HDD context for null before retrieving the handle

Check the HDD context for null before retrieving the handle since
the HDD context is dereferenced to retrieve the handle. This
prevents a possible NULL point dereference.

Change-Id: I4837f0ce8c3d995be25c08951534e5cfa189b0bb
CRs-Fixed: 1033673
This commit is contained in:
Manishekar Chandrasekaran
2016-06-24 04:45:33 +05:30
committed by Gerrit - the friendly Code Review server
父節點 2e71e93707
當前提交 79746acb37

查看文件

@@ -5159,18 +5159,18 @@ static uint8_t hdd_get_safe_channel_from_pcl_and_acs_range(
hdd_context_t *hdd_ctx;
bool found = false;
hal_handle = WLAN_HDD_GET_HAL_CTX(adapter);
if (!hal_handle) {
hdd_err("invalid HAL handle");
return INVALID_CHANNEL_ID;
}
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
if (!hdd_ctx) {
hdd_err("invalid HDD context");
return INVALID_CHANNEL_ID;
}
hal_handle = WLAN_HDD_GET_HAL_CTX(adapter);
if (!hal_handle) {
hdd_err("invalid HAL handle");
return INVALID_CHANNEL_ID;
}
status = cds_get_pcl_for_existing_conn(CDS_SAP_MODE,
pcl.pcl_list, &pcl.pcl_len,
pcl.weight_list, QDF_ARRAY_SIZE(pcl.weight_list));