Merge tag 'dmaengine-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
[linux-2.6-microblaze.git] / net / wireless / scan.c
index 4f06c18..f03c7ac 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright 2016      Intel Deutschland GmbH
- * Copyright (C) 2018-2020 Intel Corporation
+ * Copyright (C) 2018-2021 Intel Corporation
  */
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -618,7 +618,7 @@ static int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
 
                freq = ieee80211_channel_to_frequency(ap_info->channel, band);
 
-               if (end - pos < count * ap_info->tbtt_info_len)
+               if (end - pos < count * length)
                        break;
 
                /*
@@ -630,7 +630,7 @@ static int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
                if (band != NL80211_BAND_6GHZ ||
                    (length != IEEE80211_TBTT_INFO_OFFSET_BSSID_BSS_PARAM &&
                     length < IEEE80211_TBTT_INFO_OFFSET_BSSID_SSSID_BSS_PARAM)) {
-                       pos += count * ap_info->tbtt_info_len;
+                       pos += count * length;
                        continue;
                }
 
@@ -653,7 +653,7 @@ static int cfg80211_parse_colocated_ap(const struct cfg80211_bss_ies *ies,
                                kfree(entry);
                        }
 
-                       pos += ap_info->tbtt_info_len;
+                       pos += length;
                }
        }
 
@@ -757,7 +757,8 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
        }
 
        request = kzalloc(struct_size(request, channels, n_channels) +
-                         sizeof(*request->scan_6ghz_params) * count,
+                         sizeof(*request->scan_6ghz_params) * count +
+                         sizeof(*request->ssids) * rdev_req->n_ssids,
                          GFP_KERNEL);
        if (!request) {
                cfg80211_free_coloc_ap_list(&coloc_ap_list);
@@ -848,9 +849,18 @@ skip:
 
        if (request->n_channels) {
                struct cfg80211_scan_request *old = rdev->int_scan_req;
-
                rdev->int_scan_req = request;
 
+               /*
+                * Add the ssids from the parent scan request to the new scan
+                * request, so the driver would be able to use them in its
+                * probe requests to discover hidden APs on PSC channels.
+                */
+               request->ssids = (void *)&request->channels[request->n_channels];
+               request->n_ssids = rdev_req->n_ssids;
+               memcpy(request->ssids, rdev_req->ssids, sizeof(*request->ssids) *
+                      request->n_ssids);
+
                /*
                 * If this scan follows a previous scan, save the scan start
                 * info from the first part of the scan