Browse Source

qcacmn: Check NAN iface with same name before creating another one

There were some corner cases reported in which NDIs are getting
created with same name. Providing fix for the same.

Change-Id: I84ea80580faa44809e257d3b17645808637b5d51
CRs-Fixed: 2072509
Naveen Rawat 7 năm trước cách đây
mục cha
commit
fabadbbf6a
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      src/os_if_nan.c

+ 9 - 0
src/os_if_nan.c

@@ -32,6 +32,7 @@
 #include "wlan_objmgr_psoc_obj.h"
 #include "wlan_objmgr_pdev_obj.h"
 #include "wlan_objmgr_vdev_obj.h"
+#include "wlan_utility.h"
 
 /* NLA policy */
 static const struct nla_policy
@@ -87,6 +88,14 @@ static int os_if_nan_process_ndi_create(struct wlan_objmgr_psoc *psoc,
 	}
 	iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]);
 
+	nan_vdev = wlan_util_get_vdev_by_ifname(psoc, iface_name, WLAN_NAN_ID);
+	if (nan_vdev) {
+		cfg80211_err("NAN data interface %s is already present",
+			     iface_name);
+		wlan_objmgr_vdev_release_ref(nan_vdev, WLAN_NAN_ID);
+		return -EEXIST;
+	}
+
 	if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID]) {
 		cfg80211_err("transaction id is unavailable");
 		return -EINVAL;