Skip to content

Commit e308150

Browse files
Rajkumar Manoharanlinvjw
authored andcommitted
wireless: Do not allow disabled channel in scan request
cfg80211_conn_scan allows disabled channels at scan request. Hence probe request was seen at the disabled one. This patch ensures that disabled channel never be added into the scan request's channel list. Acked-by: Johannes Berg <[email protected]> Signed-off-by: Rajkumar Manoharan <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 4d8b614 commit e308150

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

net/wireless/sme.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,22 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
110110
else {
111111
int i = 0, j;
112112
enum ieee80211_band band;
113+
struct ieee80211_supported_band *bands;
114+
struct ieee80211_channel *channel;
113115

114116
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
115-
if (!wdev->wiphy->bands[band])
117+
bands = wdev->wiphy->bands[band];
118+
if (!bands)
116119
continue;
117-
for (j = 0; j < wdev->wiphy->bands[band]->n_channels;
118-
i++, j++)
119-
request->channels[i] =
120-
&wdev->wiphy->bands[band]->channels[j];
121-
request->rates[band] =
122-
(1 << wdev->wiphy->bands[band]->n_bitrates) - 1;
120+
for (j = 0; j < bands->n_channels; j++) {
121+
channel = &bands->channels[j];
122+
if (channel->flags & IEEE80211_CHAN_DISABLED)
123+
continue;
124+
request->channels[i++] = channel;
125+
}
126+
request->rates[band] = (1 << bands->n_bitrates) - 1;
123127
}
128+
n_channels = i;
124129
}
125130
request->n_channels = n_channels;
126131
request->ssids = (void *)&request->channels[n_channels];

0 commit comments

Comments
 (0)