Skip to content

Commit

Permalink
nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds
Browse files Browse the repository at this point in the history
commit 4b2c5a1 upstream.

commit 1222a16 ("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.

Cc: stable@vger.kernel.org
Fixes: 1222a16 ("nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Link: https://lore.kernel.org/r/20190908005653.17433-1-masashi.honma@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
masap authored and gregkh committed Sep 21, 2019
1 parent 941431c commit 6a10e87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -10270,9 +10270,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) {
Expand Down

0 comments on commit 6a10e87

Please sign in to comment.