Browse Source

qcacld-3.0: Check if peer id exists before adding

Currently peer id is added to map unmap array with out
checking if its already added before. This leads to having
duplicate entries and host sends peer unmap conformation
to FW with duplicates which leads to FW assert. So check
if peer id exists before adding to the array.

Change-Id: Ifcf73145f241e8ad48ff0eba9d87880565e65bb6
CRs-Fixed: 2381577
Sravan Kumar Kairam 6 năm trước cách đây
mục cha
commit
5c65634429
1 tập tin đã thay đổi với 15 bổ sung4 xóa
  1. 15 4
      core/dp/txrx/ol_txrx_peer_find.c

+ 15 - 4
core/dp/txrx/ol_txrx_peer_find.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -619,6 +619,7 @@ void ol_rx_peer_unmap_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id)
 	if (qdf_atomic_dec_and_test
 		(&pdev->peer_id_to_obj_map[peer_id].peer_id_ref_cnt)) {
 		bool peer_id_matched = false;
+		bool added = false;
 		pdev->peer_id_to_obj_map[peer_id].peer = NULL;
 		for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
 			if (peer->peer_ids[i] == peer_id) {
@@ -629,12 +630,22 @@ void ol_rx_peer_unmap_handler(ol_txrx_pdev_handle pdev, uint16_t peer_id)
 		}
 		if (pdev->enable_peer_unmap_conf_support && peer_id_matched) {
 			for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
-				if (peer->map_unmap_peer_ids[i] ==
-							HTT_INVALID_PEER) {
-					peer->map_unmap_peer_ids[i] = peer_id;
+				if (peer->map_unmap_peer_ids[i] == peer_id) {
+					added = true;
 					break;
 				}
 			}
+
+			if (!added) {
+				for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) {
+					if (peer->map_unmap_peer_ids[i] ==
+					    HTT_INVALID_PEER) {
+						peer->map_unmap_peer_ids[i] =
+									peer_id;
+						break;
+					}
+				}
+			}
 		}
 	}