Browse Source

qcacld-3.0: add NULL check before soc dereference

This is to fix the error of missing soc NULL check.
Before dereferencing soc for decoding pdev handle,
add the NULL check for soc.

Change-Id: Idade64fd88790e9a6faffceb99fc42dcd683677d
CRs-Fixed: 2668317
Vevek Venkatesan 5 years ago
parent
commit
3acd66498f
1 changed files with 9 additions and 6 deletions
  1. 9 6
      core/dp/txrx/ol_txrx_event.c

+ 9 - 6
core/dp/txrx/ol_txrx_event.c

@@ -72,20 +72,23 @@ wdi_event_handler(enum WDI_EVENT event,
 	uint32_t event_index;
 	wdi_event_subscribe *wdi_sub;
 	struct ol_txrx_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC);
-	ol_txrx_pdev_handle txrx_pdev =
-		ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
+	ol_txrx_pdev_handle txrx_pdev;
 
 	/*
 	 * Input validation
 	 */
 	if (!event) {
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
-			  "Invalid WDI event in %s\n", __func__);
+		ol_txrx_err("Invalid WDI event");
+		return;
+	}
+	if (!soc) {
+		ol_txrx_err("Invalid soc");
 		return;
 	}
+
+	txrx_pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id);
 	if (!txrx_pdev) {
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
-			  "Invalid pdev in WDI event handler\n");
+		ol_txrx_err("Invalid pdev");
 		return;
 	}
 	/*