]> git.hungrycats.org Git - linux/commitdiff
nl80211: Fix possible Spectre-v1 for NL80211_TXRATE_HT
authorMasashi Honma <masashi.honma@gmail.com>
Tue, 25 Sep 2018 02:15:00 +0000 (11:15 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:42:42 +0000 (07:42 -0800)
[ Upstream commit 30fe6d50eb088783c8729c7d930f65296b2b3fa7 ]

Use array_index_nospec() to sanitize ridx with respect to speculation.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/wireless/nl80211.c

index 0e91ec49d3da1158719de923b4b88f32981bc5ea..549d0a4083b34975689cfd28d0a55e2ed0b68319 100644 (file)
@@ -3422,6 +3422,7 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
                        return false;
 
                /* check availability */
+               ridx = array_index_nospec(ridx, IEEE80211_HT_MCS_MASK_LEN);
                if (sband->ht_cap.mcs.rx_mask[ridx] & rbit)
                        mcs[ridx] |= rbit;
                else