Hi!
commit 4b2c5a14cd8005a900075f7dfec87473c6ee66fb upstream.
commit 1222a1601488 ("nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds") was incomplete and requires one more fix to prevent accessing to rssi_thresholds[n] because user can control rssi_thresholds[i] values to make i reach to n. For example, rssi_thresholds = {-400, -300, -200, -100} when last is -34.
@@ -10270,9 +10270,11 @@ static int cfg80211_cqm_rssi_update(stru hyst = wdev->cqm_config->rssi_hyst; n = wdev->cqm_config->n_rssi_thresholds;
- for (i = 0; i < n; i++)
- for (i = 0; i < n; i++) {
if (last < wdev->cqm_config->rssi_thresholds[i]) break;i = array_index_nospec(i, n);
- }
Variable "i" is not controlled by userspace: it is initialized by kernel and runs from 0 to n.
I don't see a spectre vulnerability here.
[In fact, other array_index_nospec() uses in this function seem also unneccessary.]
Best regards, Pavel