Procházet zdrojové kódy

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
Bala Venkatesh před 5 roky
rodič
revize
42e07eac72
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. 4 2
      core/hdd/src/wlan_hdd_hostapd.c

+ 4 - 2
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,