Parcourir la source

qcacmn: Set VDEV SELF PEER and BSS peer to NULL on peer detach

Currently, On peer attach object manager set self peer
and bss peer. But on peer detach it does not clear
SELF PEER and BSS peer to NULL hence in race conditions
other components are accessing invalid BSS peer.
As a part of the fix, Set them to NULL on vdev peer detach.

Change-Id: I9a2bbfed8665dcb3bf2509f124dba2a5f3de8c55
CRs-Fixed: 2007748
Mukul Sharma il y a 8 ans
Parent
commit
d10b269500
1 fichiers modifiés avec 25 ajouts et 0 suppressions
  1. 25 0
      umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

+ 25 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -614,6 +614,31 @@ QDF_STATUS wlan_objmgr_vdev_peer_detach(struct wlan_objmgr_vdev *vdev,
 		wlan_vdev_obj_unlock(vdev);
 		return QDF_STATUS_E_FAILURE;
 	}
+
+	if (wlan_peer_get_peer_type(peer) == WLAN_PEER_AP) {
+		if (wlan_vdev_get_selfpeer(vdev) == peer) {
+			/*
+			 * There might be instances where new node is created
+			 * before deleting existing node, in which case selfpeer
+			 * will be pointing to the new node. So set selfpeer to
+			 * NULL only if vdev->vdev_objmgr.self_peer is pointing
+			 * to the peer processed for deletion
+			 */
+			wlan_vdev_set_selfpeer(vdev, NULL);
+		}
+
+		if (wlan_vdev_get_bsspeer(vdev) == peer) {
+			/*
+			 * There might be instances where new node is created
+			 * before deleting existing node, in which case bsspeer
+			 * in vdev will be pointing to the new node. So set
+			 * bsspeer to NULL only if vdev->vdev_objmgr.bss_peer is
+			 * pointing to the peer processed for deletion
+			 */
+			wlan_vdev_set_bsspeer(vdev, NULL);
+		}
+	}
+
 	/* remove peer from vdev's peer list */
 	if (wlan_obj_vdev_peerlist_remove_peer(&objmgr->wlan_peer_list, peer)
 				== QDF_STATUS_E_FAILURE) {