From 15c7379b4d95bbf594bf5402c227119ba707c7cd Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 8 Sep 2022 15:33:08 -0700 Subject: [PATCH] rrm: constrain scan frequency before scanning The RRM module was blindly scanning using the requested frequency which may or may not be possible given the hardware. Instead check that the frequency will work and if not reject the request. This was reported by a user seeing the RRM scan fail which was due to the AP requesting a scan on 5GHz when the adapter was 2.4GHz only. --- src/rrm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rrm.c b/src/rrm.c index 311e62fb..fceff5c7 100644 --- a/src/rrm.c +++ b/src/rrm.c @@ -443,6 +443,9 @@ static void rrm_handle_beacon_scan(struct rrm_state *rrm, freq = band_channel_to_freq(beacon->channel, band); scan_freq_set_add(freqs, freq); + if (!wiphy_constrain_freq_set(wiphy_find_by_wdev(rrm->wdev_id), freqs)) + goto free_freqs; + if (passive) beacon->scan_id = scan_passive_full(rrm->wdev_id, ¶ms, rrm_scan_triggered, @@ -454,12 +457,13 @@ static void rrm_handle_beacon_scan(struct rrm_state *rrm, rrm_scan_results, rrm, NULL); +free_freqs: scan_freq_set_free(freqs); - if (beacon->scan_id == 0) { - rrm_info_destroy(&beacon->info); - rrm->pending = NULL; - } + if (beacon->scan_id) + return; + + rrm_reject_measurement_request(rrm, REPORT_REJECT_INCAPABLE); } static bool rrm_verify_beacon_request(const uint8_t *request, size_t len)