summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManjeet Singh <manjee@codeaurora.org>2016-09-03 12:14:25 +0530
committerqcabuildsw <qcabuildsw@localhost>2016-09-10 19:05:50 -0700
commit01327cc3ec6c96bd9bc3f6d8d6e898feb2cb3de7 (patch)
treedbc67c87af1335760d77537b9891ddf54c488e37
parentfde0c04dc2511fc66c8e86fd2a4824528ea61e22 (diff)
qcacld-3.0: Validate adapter magic during bus bandwidth check
qcacld-2.0 to qcacld-3.0 propagation. hdd_bus_bw_compute_cbk function is responsible for computing bus bandwidth by checking TX/RX stats per HDD adapter after taking them from adapter list. However, it's scheduled on a global timer so the following scenario can arise: 1)At time of scheduling, HDD adapter is valid and is passed. 2)During TX/RX stats check, HDD adapter is freed as a result of interface down. 3)Null hddCtx from adapter is accessed as a result and kernel panic occurs. Thus,validate adapter magic before accessing the hddCtx stored in adapter. Change-Id: If076e122db0538d01140e16305f046e68a86212a CRs-fixed: 1045004 (cherry picked from commit 27254744c270a98d15bb17e2ed48649450070385)
-rw-r--r--core/hdd/src/wlan_hdd_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 7f6aac2791da..11493ce89af9 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -5008,6 +5008,12 @@ static void hdd_bus_bw_compute_cbk(void *priv)
if (adapterNode->pAdapter == NULL)
continue;
adapter = adapterNode->pAdapter;
+ /*
+ * Validate magic so we don't end up accessing
+ * an invalid adapter.
+ */
+ if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC)
+ continue;
if ((adapter->device_mode == QDF_STA_MODE ||
adapter->device_mode == QDF_P2P_CLIENT_MODE) &&