From 3332be36b5db7541ce3234d393154f0aa83e0aa5 Mon Sep 17 00:00:00 2001 From: Orhan K AKYILDIZ Date: Wed, 31 May 2017 15:36:31 -0700 Subject: [PATCH] qcacld-3.0: Add sanity check on adapter before clean-up Add sanity check on the adapter structure, using the magic field before accessing any fields on it. Change-Id: If6965415bc0e6400ffb5924461715dff4c9efa36 CRs-Fixed: 2054084 --- core/hdd/src/wlan_hdd_ipa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 027e3175eac5..3007c0ccd9b4 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -4728,6 +4728,13 @@ static void hdd_ipa_cleanup_iface(struct hdd_ipa_iface_context *iface_context) if (iface_context == NULL) return; + if (iface_context->adapter->magic != WLAN_HDD_ADAPTER_MAGIC) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_DEBUG, + "%s: bad adapter(%pK).magic(%d)!", + __func__, iface_context->adapter, + iface_context->adapter->magic); + return; + } cdp_ipa_cleanup_iface(cds_get_context(QDF_MODULE_ID_SOC), iface_context->adapter->dev->name,