Message ID | f41b5a66279c2a106f69042d64aa2bf0f9ce81c6.1728372192.git-series.nbd@nbd.name (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
Series | wifi: cfg80211/mac80211: improve support for multiple radios | expand |
> Reject frequencies not supported by any radio that the vif is allowed to use. Should line-break to fewer chars per line, though I guess you're not over by much (78 vs. 75) :) > +++ b/net/mac80211/scan.c > @@ -1176,14 +1176,16 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, > unsigned int n_channels) > { > struct ieee80211_local *local = sdata->local; > - int ret = -EBUSY, i, n_ch = 0; > + int ret = -EINVAL, i, n_ch = 0; > enum nl80211_band band; > > lockdep_assert_wiphy(local->hw.wiphy); > > /* busy scanning */ > - if (local->scan_req) > + if (local->scan_req) { > + ret = -EBUSY; > goto unlock; > + } > > /* fill internal scan request */ > if (!channels) { > @@ -1200,7 +1202,9 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, > &local->hw.wiphy->bands[band]->channels[i]; > > if (tmp_ch->flags & (IEEE80211_CHAN_NO_IR | > - IEEE80211_CHAN_DISABLED)) > + IEEE80211_CHAN_DISABLED) || > + !cfg80211_wdev_channel_allowed(&sdata->wdev, > + tmp_ch)) > continue; > > local->int_scan_req->channels[n_ch] = tmp_ch; > @@ -1215,14 +1219,16 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, > } else { > for (i = 0; i < n_channels; i++) { > if (channels[i]->flags & (IEEE80211_CHAN_NO_IR | > - IEEE80211_CHAN_DISABLED)) > + IEEE80211_CHAN_DISABLED) || > + !cfg80211_wdev_channel_allowed(&sdata->wdev, > + channels[i])) > continue; > > local->int_scan_req->channels[n_ch] = channels[i]; > n_ch++; > } > > - if (WARN_ON_ONCE(n_ch == 0)) > + if (n_ch == 0) > goto unlock; > You're changing the return value here and in another case hidden in the context, is that intentional? And either way it's better to just remove the unlock label and 'ret' variable while at it now, it's pretty much unused already. johannes
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index adb88c06b598..2ca75cf17242 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -1176,14 +1176,16 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, unsigned int n_channels) { struct ieee80211_local *local = sdata->local; - int ret = -EBUSY, i, n_ch = 0; + int ret = -EINVAL, i, n_ch = 0; enum nl80211_band band; lockdep_assert_wiphy(local->hw.wiphy); /* busy scanning */ - if (local->scan_req) + if (local->scan_req) { + ret = -EBUSY; goto unlock; + } /* fill internal scan request */ if (!channels) { @@ -1200,7 +1202,9 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, &local->hw.wiphy->bands[band]->channels[i]; if (tmp_ch->flags & (IEEE80211_CHAN_NO_IR | - IEEE80211_CHAN_DISABLED)) + IEEE80211_CHAN_DISABLED) || + !cfg80211_wdev_channel_allowed(&sdata->wdev, + tmp_ch)) continue; local->int_scan_req->channels[n_ch] = tmp_ch; @@ -1215,14 +1219,16 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, } else { for (i = 0; i < n_channels; i++) { if (channels[i]->flags & (IEEE80211_CHAN_NO_IR | - IEEE80211_CHAN_DISABLED)) + IEEE80211_CHAN_DISABLED) || + !cfg80211_wdev_channel_allowed(&sdata->wdev, + channels[i])) continue; local->int_scan_req->channels[n_ch] = channels[i]; n_ch++; } - if (WARN_ON_ONCE(n_ch == 0)) + if (n_ch == 0) goto unlock; local->int_scan_req->n_channels = n_ch;
Reject frequencies not supported by any radio that the vif is allowed to use. Signed-off-by: Felix Fietkau <nbd@nbd.name> --- net/mac80211/scan.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)