From 42e07eac7299a6ee8e5d3e7a05cbb2050ffdcb20 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Tue, 20 Aug 2019 15:44:31 +0530 Subject: [PATCH] qcacld-3.0: Avoid NULL pointer access In function wlan_hdd_set_sap_csa_reason, sap_ctx pointer is dereferenced without NULL check. Add NULL check to avoid null pointer access. Change-Id: I74bbfdcae6d5a06d5eaf0cd66e3ff9c3380c6bb0 CRs-Fixed: 2512034 --- core/hdd/src/wlan_hdd_hostapd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index bcdcabe3e56f..5c6456ddff45 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3085,7 +3085,8 @@ void wlan_hdd_set_sap_csa_reason(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, return; } sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter); - sap_ctx->csa_reason = reason; + if (sap_ctx) + sap_ctx->csa_reason = reason; } QDF_STATUS wlan_hdd_get_channel_for_sap_restart( @@ -3185,7 +3186,8 @@ sap_restart: hdd_ap_ctx->sap_config.channel, intf_ch); ch_params.ch_width = CH_WIDTH_MAX; hdd_ap_ctx->bss_stop_reason = BSS_STOP_DUE_TO_MCC_SCC_SWITCH; - hdd_ap_ctx->sap_context->csa_reason = + if (hdd_ap_ctx->sap_context) + hdd_ap_ctx->sap_context->csa_reason = CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL; wlan_reg_set_channel_params(hdd_ctx->pdev,