Commit 6ea51fc7 authored by Arend Van Spriel's avatar Arend Van Spriel Committed by Kalle Valo

brcmfmac: only add channels and ssids once in scan request

When receiving pno results there may be duplicate channels and/or
ssids. Assure each is added only once when preparing the internal
escan request.
Reviewed-by: default avatarHante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: default avatarFranky Lin <franky.lin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 6594e1e8
...@@ -3216,7 +3216,7 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req, ...@@ -3216,7 +3216,7 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req,
{ {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
enum nl80211_band band; enum nl80211_band band;
int freq; int freq, i;
if (channel <= CH_MAX_2G_CHANNEL) if (channel <= CH_MAX_2G_CHANNEL)
band = NL80211_BAND_2GHZ; band = NL80211_BAND_2GHZ;
...@@ -3231,10 +3231,22 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req, ...@@ -3231,10 +3231,22 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req,
if (!chan) if (!chan)
return -EINVAL; return -EINVAL;
req->channels[req->n_channels++] = chan; for (i = 0; i < req->n_channels; i++) {
memcpy(req->ssids[req->n_ssids].ssid, ssid, ssid_len); if (req->channels[i] == chan)
req->ssids[req->n_ssids++].ssid_len = ssid_len; break;
}
if (i == req->n_channels)
req->channels[req->n_channels++] = chan;
for (i = 0; i < req->n_ssids; i++) {
if (req->ssids[i].ssid_len == ssid_len &&
!memcmp(req->ssids[i].ssid, ssid, ssid_len))
break;
}
if (i == req->n_ssids) {
memcpy(req->ssids[req->n_ssids].ssid, ssid, ssid_len);
req->ssids[req->n_ssids++].ssid_len = ssid_len;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment