Browse Source

qcacld-3.0: Add null check for qdf_ctx in hdd_configure_cds

Currently in function hdd_configure_cds the driver is passing
the pointer from cds_get_context to ucfg_ipa_uc_ol_init without any
NULL check. This pointer later then gets dereferenced which can cause
null pointer dereference.

To solve this, added a null check before calling ucfg_ipa_uc_ol_init

Change-Id: Ie0d8e103c9eeac76d285c4b3870c3c4ea9172dc6
CRs-Fixed: 2462711
Varuneshwar Petlozu 5 years ago
parent
commit
f876667985
1 changed files with 9 additions and 2 deletions
  1. 9 2
      core/hdd/src/wlan_hdd_main.c

+ 9 - 2
core/hdd/src/wlan_hdd_main.c

@@ -11181,6 +11181,7 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx)
 	bool value;
 	enum pmo_auto_pwr_detect_failure_mode auto_power_fail_mode;
 	bool bval = false;
+	qdf_device_t qdf_ctx;
 
 	mac_handle = hdd_ctx->mac_handle;
 
@@ -11277,8 +11278,14 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx)
 	 * IPA module before configuring them to FW. Sequence required as crash
 	 * observed otherwise.
 	 */
-	if (ucfg_ipa_uc_ol_init(hdd_ctx->pdev,
-				cds_get_context(QDF_MODULE_ID_QDF_DEVICE))) {
+
+	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
+	if (!qdf_ctx) {
+		hdd_err("QDF device context is NULL");
+		goto out;
+	}
+
+	if (ucfg_ipa_uc_ol_init(hdd_ctx->pdev, qdf_ctx)) {
 		hdd_err("Failed to setup pipes");
 		goto out;
 	}