linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds
@ 2019-09-08  0:56 Masashi Honma
  0 siblings, 0 replies; only message in thread
From: Masashi Honma @ 2019-09-08  0:56 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, dan.carpenter, Masashi Honma

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.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 net/wireless/nl80211.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3e30e18d1d89..773b22654c23 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-08  0:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-08  0:56 [PATCH] nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds Masashi Honma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).