From 79746acb37a9600aa7d5df6eac0bacfcfd3d18c7 Mon Sep 17 00:00:00 2001 From: Manishekar Chandrasekaran Date: Fri, 24 Jun 2016 04:45:33 +0530 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a9245e0069..aa243cf59d 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -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));