Browse Source

qcacld-3.0: Peer may not be present if NDP confirm fails

NDP peer gets created as part of NDP indication in case of NDP
initiator. But NDP may fail to form due to various reasons and
firmware may send NDP confirm with reject status in such cases
instead of NDP indication event.
Below is the detailed scenario,
1. On initiator side, it has sent an NDP request and is waiting
   for NDP response.
2. On responder side, application/framework is preparing to send
   NDP response with reject due to some config mismatch. At the
   same time, NDP termination is also issued. So NDP termination
   frame is sent successfully.
3. Initiator firmware receives this NDP end and it sends an NDP
   confirm with REJECT to the host and it shall clean-up the
   session.

Currrently, there is a check for the peer existence while
indicating this NDP confirm status to framework. There is no need
of this check in such failure cases as peer is not yet created.

Change-Id: Ibe94a5b67df1ce3d65eaf2ef37b11b08155752c9
CRs-Fixed: 3086975
Srinivas Dasari 3 years ago
parent
commit
accd92e85d
1 changed files with 5 additions and 3 deletions
  1. 5 3
      components/nan/core/src/nan_main.c

+ 5 - 3
components/nan/core/src/nan_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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
@@ -564,11 +564,13 @@ static QDF_STATUS nan_handle_confirm(struct nan_datapath_confirm_event *confirm)
 	peer = wlan_objmgr_get_peer_by_mac(psoc,
 					   confirm->peer_ndi_mac_addr.bytes,
 					   WLAN_NAN_ID);
-	if (!peer) {
+	if (!peer && confirm->rsp_code == NAN_DATAPATH_RESPONSE_ACCEPT) {
 		nan_debug("Drop NDP confirm as peer isn't available");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
-	wlan_objmgr_peer_release_ref(peer, WLAN_NAN_ID);
+
+	if (peer)
+		wlan_objmgr_peer_release_ref(peer, WLAN_NAN_ID);
 
 	psoc_nan_obj = nan_get_psoc_priv_obj(psoc);
 	if (!psoc_nan_obj) {