nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds
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.
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Masashi Honma <[email protected]>
--- net/wireless/nl80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/wireless/nl80211.c +3 -1
@@ -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