Skip to content

Commit

Permalink
mac80211: off by one in mcs mask handling
Browse files Browse the repository at this point in the history
"ridx" is used as an index into the mcs_mask[] array which has
IEEE80211_HT_MCS_MASK_LEN elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Dan Carpenter authored and John W. Linville committed Feb 6, 2012
1 parent d486a5b commit 910570b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/mac80211/rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static bool rate_idx_match_mcs_mask(struct ieee80211_tx_rate *rate,
rbit = rate->idx % 8;

/* sanity check */
if (ridx < 0 || ridx > IEEE80211_HT_MCS_MASK_LEN)
if (ridx < 0 || ridx >= IEEE80211_HT_MCS_MASK_LEN)
return false;

/* See whether the selected rate or anything below it is allowed. */
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -5410,7 +5410,7 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
rbit = BIT(rates[i] % 8);

/* check validity */
if ((ridx < 0) || (ridx > IEEE80211_HT_MCS_MASK_LEN))
if ((ridx < 0) || (ridx >= IEEE80211_HT_MCS_MASK_LEN))
return false;

/* check availability */
Expand Down

0 comments on commit 910570b

Please sign in to comment.