Browse Source

qcacld-3.0: Pass wdev as arg to vendor_event_alloc

Currently, host driver passes null as argument instead of valid
wdev to "wlan_cfg80211_vendor_event_alloc" function and
WiFi-HAL checks for the valid wdev while receiving NAN responses
and NAN response is dropped due to invalid wdev.

So, to fix this, extract the valid wdev and pass it as argument
to "wlan_cfg80211_vendor_event_alloc" function.

Change-Id: I2c50c1d6d8ebc100b0e7c382420ed031156dcebd
CRs-Fixed: 3642176
Rahul Gusain 1 year ago
parent
commit
1e3c3c688a
1 changed files with 30 additions and 1 deletions
  1. 30 1
      os_if/nan/src/os_if_nan.c

+ 30 - 1
os_if/nan/src/os_if_nan.c

@@ -2676,6 +2676,9 @@ static void os_if_nan_discovery_event_handler(struct nan_event_params *nan_evt)
 	struct pdev_osif_priv *os_priv;
 	enum qca_nl80211_vendor_subcmds_index index =
 		QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX;
+	struct wireless_dev *wdev;
+	struct vdev_osif_priv *osif_priv;
+	struct wlan_objmgr_vdev *vdev = NULL;
 
 	/*
 	 * Since Partial Offload chipsets have only one pdev per psoc, the first
@@ -2689,8 +2692,31 @@ static void os_if_nan_discovery_event_handler(struct nan_event_params *nan_evt)
 	os_if_nan_handle_sr_nan_concurrency(nan_evt);
 
 	os_priv = wlan_pdev_get_ospriv(pdev);
+	if (!os_priv) {
+		osif_err(" pdev osif priv is null");
+		goto fail;
+	}
 
-	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, NULL,
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, nan_evt->vdev_id,
+						    WLAN_NAN_ID);
+	if (!vdev) {
+		osif_err("vdev is null");
+		goto fail;
+	}
+
+	osif_priv = wlan_vdev_get_ospriv(vdev);
+	if (!osif_priv) {
+		osif_err("osif_priv is null");
+		goto fail;
+	}
+
+	wdev = osif_priv->wdev;
+	if (!wdev) {
+		osif_err("wireless dev is null");
+		goto fail;
+	}
+
+	vendor_event = wlan_cfg80211_vendor_event_alloc(os_priv->wiphy, wdev,
 							nan_evt->buf_len +
 							NLMSG_HDRLEN,
 							index, GFP_KERNEL);
@@ -2708,6 +2734,9 @@ static void os_if_nan_discovery_event_handler(struct nan_event_params *nan_evt)
 
 	wlan_cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 fail:
+	if (vdev)
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_NAN_ID);
+
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_NAN_ID);
 }