Bläddra i källkod

qcacld-3.0: Fix CDS layering violation in hdd_context_create()

Currently hdd_context_create() directly dereferences the global CDS
context pointer in order to save a pointer to the HDD context. This is
a layering violation. Instead update cds_set_context() to handle the
HDD context, and call that from hdd_context_create() to save the
pointer to the HDD context.

Change-Id: Ie54725225a7dd5653eeb35e94aa3f3a752edc62a
CRs-Fixed: 2115513
Jeff Johnson 7 år sedan
förälder
incheckning
3543fb202e
2 ändrade filer med 4 tillägg och 1 borttagningar
  1. 3 0
      core/cds/src/cds_api.c
  2. 1 1
      core/hdd/src/wlan_hdd_main.c

+ 3 - 0
core/cds/src/cds_api.c

@@ -1495,6 +1495,9 @@ QDF_STATUS cds_set_context(QDF_MODULE_ID module_id, void *context)
 	}
 
 	switch (module_id) {
+	case QDF_MODULE_ID_HDD:
+		p_cds_context->pHDDContext = context;
+		break;
 	case QDF_MODULE_ID_TXRX:
 		p_cds_context->pdev_txrx_ctx = context;
 		break;

+ 1 - 1
core/hdd/src/wlan_hdd_main.c

@@ -7833,7 +7833,7 @@ static struct hdd_context *hdd_context_create(struct device *dev)
 
 	hdd_override_ini_config(hdd_ctx);
 
-	((cds_context_type *) (p_cds_context))->pHDDContext = (void *)hdd_ctx;
+	cds_set_context(QDF_MODULE_ID_HDD, hdd_ctx);
 
 	ret = hdd_context_init(hdd_ctx);