Pārlūkot izejas kodu

qcacld-3.0: Serialize the freeing LRO descriptors

Add lock to serailize the freeing of LRO descriptors.
Without this double free of LRO descriptors lead to list
corruption.

Change-Id: I0b3c9ddecff0700ac1f6ec44f09c9ddf59997799
CRs-Fixed: 1053657
Manjunathappa Prakash 8 gadi atpakaļ
vecāks
revīzija
cf26ae6db3
2 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 2 0
      core/hdd/inc/wlan_hdd_lro.h
  2. 5 0
      core/hdd/src/wlan_hdd_lro.c

+ 2 - 0
core/hdd/inc/wlan_hdd_lro.h

@@ -101,10 +101,12 @@ struct hdd_lro_desc_info {
  * hdd_lro_s - LRO information per HDD adapter
  * @lro_mgr: LRO manager
  * @lro_desc_info: LRO descriptor information
+ * @lroi_mgr_arr_access_lock: Lock to access LRO manager array.
  */
 struct hdd_lro_s {
 	struct net_lro_mgr *lro_mgr;
 	struct hdd_lro_desc_info lro_desc_info;
+	qdf_spinlock_t lro_mgr_arr_access_lock;
 };
 
 int hdd_lro_init(hdd_context_t *hdd_ctx);

+ 5 - 0
core/hdd/src/wlan_hdd_lro.c

@@ -130,6 +130,7 @@ static void hdd_lro_desc_info_init(struct hdd_lro_s *hdd_info)
 	}
 
 	qdf_spinlock_create(&hdd_info->lro_desc_info.lro_hash_lock);
+	qdf_spinlock_create(&hdd_info->lro_mgr_arr_access_lock);
 }
 
 /**
@@ -162,6 +163,7 @@ static void hdd_lro_desc_info_deinit(struct hdd_lro_s *hdd_info)
 
 	hdd_lro_desc_pool_deinit(&desc_info->lro_desc_pool);
 	qdf_spinlock_destroy(&desc_info->lro_hash_lock);
+	qdf_spinlock_destroy(&hdd_info->lro_mgr_arr_access_lock);
 }
 
 /**
@@ -436,8 +438,10 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr,
 void hdd_lro_flush(void *data)
 {
 	hdd_adapter_t *adapter = (hdd_adapter_t *)data;
+	struct hdd_lro_s *hdd_info = &adapter->lro_info;
 	int i;
 
+	qdf_spin_lock_bh(&hdd_info->lro_mgr_arr_access_lock);
 	for (i = 0; i < adapter->lro_info.lro_mgr->max_desc; i++) {
 		if (adapter->lro_info.lro_mgr->lro_arr[i].active) {
 			hdd_lro_desc_free(
@@ -447,6 +451,7 @@ void hdd_lro_flush(void *data)
 				 &adapter->lro_info.lro_mgr->lro_arr[i]);
 		}
 	}
+	qdf_spin_unlock_bh(&hdd_info->lro_mgr_arr_access_lock);
 }
 
 /**