Parcourir la source

qcacld-3.0: Add NULL check for bss peer

In function tdls_delete_all_tdls_peers, bss peer can be NULL
if the bss peer is removed from vdev object. Hence, add  NULL
check  before getting its reference.

Change-Id: I9b2b03bc6db899c1c06de95ec5ee680d4b600aa7
CRs-Fixed: 2419567
Bala Venkatesh il y a 6 ans
Parent
commit
3b113c5ec3
1 fichiers modifiés avec 9 ajouts et 9 suppressions
  1. 9 9
      components/tdls/core/src/wlan_tdls_ct.c

+ 9 - 9
components/tdls/core/src/wlan_tdls_ct.c

@@ -1151,18 +1151,18 @@ QDF_STATUS tdls_delete_all_tdls_peers(struct wlan_objmgr_vdev *vdev,
 	struct scheduler_msg msg = {0};
 	QDF_STATUS status;
 
+	peer = wlan_vdev_get_bsspeer(vdev);
+	if (!peer)
+		return QDF_STATUS_E_FAILURE;
 
-	del_msg = qdf_mem_malloc(sizeof(*del_msg));
-	if (NULL == del_msg) {
-		tdls_err("memory alloc failed");
+	if (QDF_STATUS_SUCCESS !=
+	    wlan_objmgr_peer_try_get_ref(peer, WLAN_TDLS_SB_ID))
 		return QDF_STATUS_E_FAILURE;
-	}
-	qdf_mem_zero(del_msg, sizeof(*del_msg));
 
-	peer = wlan_vdev_get_bsspeer(vdev);
-	if (QDF_STATUS_SUCCESS != wlan_objmgr_peer_try_get_ref(peer,
-							WLAN_TDLS_SB_ID)) {
-		qdf_mem_free(del_msg);
+	del_msg = qdf_mem_malloc(sizeof(*del_msg));
+	if (!del_msg) {
+		tdls_err("memory alloc failed");
+		wlan_objmgr_peer_release_ref(peer, WLAN_TDLS_SB_ID);
 		return QDF_STATUS_E_FAILURE;
 	}