diff options
author | Masashi Honma <masashi.honma@gmail.com> | 2019-09-08 09:56:53 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-21 07:15:30 +0200 |
commit | 4dae18fe79b914f066f8bff3b2519c01ce737503 (patch) | |
tree | 97c22ef48b167b29c5b42e59c7b49d13f564a4e4 | |
parent | a723f89aa82fd51f2fc2b8c71928324531b37215 (diff) | |
download | linux-stable-4dae18fe79b914f066f8bff3b2519c01ce737503.tar.gz linux-stable-4dae18fe79b914f066f8bff3b2519c01ce737503.tar.bz2 linux-stable-4dae18fe79b914f066f8bff3b2519c01ce737503.zip |
nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds
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.
Cc: stable@vger.kernel.org
Fixes: 1222a1601488 ("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>
-rw-r--r-- | net/wireless/nl80211.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c672a790df1c..f19d5a55f09e 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -9753,9 +9753,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) { |