From 6d1be188ca7d638d9644be5454598c2fdfad4128 Mon Sep 17 00:00:00 2001 From: Manjeet Singh Date: Tue, 26 Jul 2016 11:28:20 +0530 Subject: qcacld-2.0: Validate adapter magic during bus bandwidth check 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 --- CORE/HDD/src/wlan_hdd_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 8bcb0ac5a87f..3d5b9c9113e4 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -13752,6 +13752,9 @@ static void hdd_bus_bw_compute_cbk(void *priv) if ((pAdapter = pAdapterNode->pAdapter) == NULL) continue; + /* Validate magic so we don't end up accessing a freed adapter.*/ + if (pAdapter->magic != WLAN_HDD_ADAPTER_MAGIC) + continue; #ifdef IPA_UC_OFFLOAD if (NULL == pValidAdapter) -- cgit v1.2.3