317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From: Konstantin Khlebnikov <koct9i@gmail.com>
  2. Date: Fri, 29 Jan 2016 11:35:12 +0300
  3. Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4. minstrel_ht_set_best_prob_rate
  5. Patch fixes this splat
  6. BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  7. [mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  8. Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  9. Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  10. ---
  11. --- a/net/mac80211/rc80211_minstrel_ht.c
  12. +++ b/net/mac80211/rc80211_minstrel_ht.c
  13. @@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  14. (max_tp_group != MINSTREL_CCK_GROUP))
  15. return;
  16. + max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  17. + max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  18. + max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  19. +
  20. if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  21. cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  22. mrs->prob_ewma);
  23. if (cur_tp_avg > tmp_tp_avg)
  24. mi->max_prob_rate = index;
  25. - max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  26. - max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  27. - max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  28. max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  29. max_gpr_idx,
  30. max_gpr_prob);
  31. @@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  32. } else {
  33. if (mrs->prob_ewma > tmp_prob)
  34. mi->max_prob_rate = index;
  35. - if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  36. + if (mrs->prob_ewma > max_gpr_prob)
  37. mg->max_group_prob_rate = index;
  38. }
  39. }