Skip to contentSkip to conversation

nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds

PATCH New Masashi Honma 1 participant 1 message Sep 8, 2019 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds

commit 1222a16014888ed9733c11e221730d4a8196222b "nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds" 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.

---
 net/wireless/nl80211.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/wireless/nl80211.c +3 -1
index 3e30e18d1d89..773b22654c23 100644
@@ -10805,9 +10805,11 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
 	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++) {
+		i = array_index_nospec(i, n);
 		if (last < wdev->cqm_config->rssi_thresholds[i])
 			break;
+	}
 
 	low_index = i - 1;
 	if (low_index >= 0) {
Signature · 1 line
2.17.1