Browse Source

qcacld-3.0: NULL pointer access in start acs api

There is no sanity check for hdd context and sap config in
start acs api which may lead to NULL pointer access.

To avoid this issue, validate hdd context and sap config
before accessing these pointers.

Change-Id: I0a3f6a91a6bc5a517c035c9e7d706e66aea62fd4
CRs-Fixed: 2331412
Ashish Kumar Dhanotiya 6 years ago
parent
commit
b0629626ee
1 changed files with 8 additions and 0 deletions
  1. 8 0
      core/hdd/src/wlan_hdd_cfg80211.c

+ 8 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -1753,7 +1753,15 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 		return -EINVAL;
 	}
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return -EINVAL;
+	}
 	sap_config = &adapter->session.ap.sap_config;
+	if (!sap_config) {
+		hdd_err("SAP config is NULL");
+		return -EINVAL;
+	}
 	if (hdd_ctx->acs_policy.acs_channel)
 		sap_config->channel = hdd_ctx->acs_policy.acs_channel;
 	else