From 2359ca00da6e08598743615cb237f9754d35a2ba Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Wed, 21 Sep 2016 16:57:28 -0700 Subject: [PATCH] qcacld-3.0: Fix free_pool referencing in hdd_lro_desc_find list_empty api does not work correctly on copied list head. Need to point to the original free_pool memory so that the spinlocking and list management apis work as expected on the original memory. Change-Id: I631466d156c83f70cb6ea06eec0e361081f294cc CRs-Fixed: 1070258 --- core/hdd/src/wlan_hdd_lro.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/hdd/src/wlan_hdd_lro.c b/core/hdd/src/wlan_hdd_lro.c index dde5d9e4fc01..857d2c154a7a 100644 --- a/core/hdd/src/wlan_hdd_lro.c +++ b/core/hdd/src/wlan_hdd_lro.c @@ -214,7 +214,7 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter, struct hdd_lro_desc_table *lro_hash_table; struct list_head *ptr; struct hdd_lro_desc_entry *entry; - struct hdd_lro_desc_pool free_pool; + struct hdd_lro_desc_pool *free_pool; struct hdd_lro_desc_info *desc_info = &adapter->lro_info.lro_desc_info; *lro_desc = NULL; @@ -245,24 +245,19 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter, qdf_spin_unlock_bh(&desc_info->lro_hash_lock); /* no existing flow found, a new LRO desc needs to be allocated */ - free_pool = adapter->lro_info.lro_desc_info.lro_desc_pool; - qdf_spin_lock_bh(&free_pool.lro_pool_lock); + free_pool = &adapter->lro_info.lro_desc_info.lro_desc_pool; + qdf_spin_lock_bh(&free_pool->lro_pool_lock); entry = list_first_entry_or_null( - &free_pool.lro_free_list_head, + &free_pool->lro_free_list_head, struct hdd_lro_desc_entry, lro_node); if (NULL == entry) { hdd_err("Could not allocate LRO desc!"); - qdf_spin_unlock_bh(&free_pool.lro_pool_lock); + qdf_spin_unlock_bh(&free_pool->lro_pool_lock); return -ENOMEM; } - if (list_empty(&entry->lro_node)) { - hdd_err("Reached max supported lro_desc range\n"); - return -EINVAL; - } - list_del_init(&entry->lro_node); - qdf_spin_unlock_bh(&free_pool.lro_pool_lock); + qdf_spin_unlock_bh(&free_pool->lro_pool_lock); if (NULL == entry->lro_desc) { hdd_err("entry->lro_desc is NULL!\n");