TO: Karl Beldan <[email protected]>
CC: Johannes Berg <[email protected]>

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d7e5a72b951a4ef6d97b2aa43cad37f237ba8030
commit: d4d141cae804a430054f4138fa177229114f203a [1093/6788] mac80211: 
minstrel_ht: Increase the range of handled rate indexes
:::::: branch date: 15 hours ago
:::::: commit date: 4 weeks ago

net/mac80211/rc80211_minstrel_ht.c:255 minstrel_ht_sort_best_tp_rates() error: 
buffer overflow 'tp_list' 2 <= 3
net/mac80211/rc80211_minstrel_ht.c:256 minstrel_ht_sort_best_tp_rates() error: 
buffer overflow 'tp_list' 2 <= 3
net/mac80211/rc80211_minstrel_ht.c:270 minstrel_ht_sort_best_tp_rates() warn: 
buffer overflow 'tp_list' 2 <= 2
net/mac80211/rc80211_minstrel_ht.c:274 minstrel_ht_sort_best_tp_rates() error: 
buffer overflow 'tp_list' 2 <= 3
net/mac80211/rc80211_minstrel_ht.c:340 minstrel_ht_assign_best_tp_rates() 
error: buffer overflow 'tmp_cck_tp_rate' 2 <= 3

git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout d4d141cae804a430054f4138fa177229114f203a
vim +/tp_list +255 net/mac80211/rc80211_minstrel_ht.c

5935839a Thomas Huehn 2014-09-09  249  
5935839a Thomas Huehn 2014-09-09  250   cur_group = index / MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  251   cur_idx = index  % MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  252   cur_thr = 
mi->groups[cur_group].rates[cur_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  253   cur_prob = 
mi->groups[cur_group].rates[cur_idx].probability;
5935839a Thomas Huehn 2014-09-09  254  
5935839a Thomas Huehn 2014-09-09 @255   tmp_group = tp_list[j - 1] / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09 @256   tmp_idx = tp_list[j - 1] % 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  257   tmp_thr = 
mi->groups[tmp_group].rates[tmp_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  258   tmp_prob = 
mi->groups[tmp_group].rates[tmp_idx].probability;
5935839a Thomas Huehn 2014-09-09  259  
5935839a Thomas Huehn 2014-09-09  260   while (j > 0 && (cur_thr > tmp_thr ||
5935839a Thomas Huehn 2014-09-09  261         (cur_thr == tmp_thr && cur_prob > 
tmp_prob))) {
5935839a Thomas Huehn 2014-09-09  262           j--;
5935839a Thomas Huehn 2014-09-09  263           tmp_group = tp_list[j - 1] / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  264           tmp_idx = tp_list[j - 1] % 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  265           tmp_thr = 
mi->groups[tmp_group].rates[tmp_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  266           tmp_prob = 
mi->groups[tmp_group].rates[tmp_idx].probability;
5935839a Thomas Huehn 2014-09-09  267   }
5935839a Thomas Huehn 2014-09-09  268  
5935839a Thomas Huehn 2014-09-09  269   if (j < MAX_THR_RATES - 1) {
5935839a Thomas Huehn 2014-09-09 @270           memmove(&tp_list[j + 1], 
&tp_list[j], (sizeof(*tp_list) *
5935839a Thomas Huehn 2014-09-09  271                  (MAX_THR_RATES - (j + 
1))));
5935839a Thomas Huehn 2014-09-09  272   }
5935839a Thomas Huehn 2014-09-09  273   if (j < MAX_THR_RATES)
5935839a Thomas Huehn 2014-09-09 @274           tp_list[j] = index;
5935839a Thomas Huehn 2014-09-09  275  }
5935839a Thomas Huehn 2014-09-09  276  
5935839a Thomas Huehn 2014-09-09  277  /*
5935839a Thomas Huehn 2014-09-09  278   * Find and set the topmost probability 
rate per sta and per group
5935839a Thomas Huehn 2014-09-09  279   */
5935839a Thomas Huehn 2014-09-09  280  static void
d4d141ca Karl Beldan  2014-10-20  281  minstrel_ht_set_best_prob_rate(struct 
minstrel_ht_sta *mi, u16 index)
5935839a Thomas Huehn 2014-09-09  282  {
5935839a Thomas Huehn 2014-09-09  283   struct minstrel_mcs_group_data *mg;
5935839a Thomas Huehn 2014-09-09  284   struct minstrel_rate_stats *mr;
5935839a Thomas Huehn 2014-09-09  285   int tmp_group, tmp_idx, tmp_tp, 
tmp_prob, max_tp_group;
5935839a Thomas Huehn 2014-09-09  286  
5935839a Thomas Huehn 2014-09-09  287   mg = &mi->groups[index / 
MCS_GROUP_RATES];
5935839a Thomas Huehn 2014-09-09  288   mr = &mg->rates[index % 
MCS_GROUP_RATES];
5935839a Thomas Huehn 2014-09-09  289  
5935839a Thomas Huehn 2014-09-09  290   tmp_group = mi->max_prob_rate / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  291   tmp_idx = mi->max_prob_rate % 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  292   tmp_tp = 
mi->groups[tmp_group].rates[tmp_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  293   tmp_prob = 
mi->groups[tmp_group].rates[tmp_idx].probability;
5935839a Thomas Huehn 2014-09-09  294  
5935839a Thomas Huehn 2014-09-09  295   /* if max_tp_rate[0] is from MCS_GROUP 
max_prob_rate get selected from
5935839a Thomas Huehn 2014-09-09  296    * MCS_GROUP as well as CCK_GROUP rates 
do not allow aggregation */
5935839a Thomas Huehn 2014-09-09  297   max_tp_group = mi->max_tp_rate[0] / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  298   if((index / MCS_GROUP_RATES == 
MINSTREL_CCK_GROUP) &&
5935839a Thomas Huehn 2014-09-09  299       (max_tp_group != 
MINSTREL_CCK_GROUP))
5935839a Thomas Huehn 2014-09-09  300           return;
5935839a Thomas Huehn 2014-09-09  301  
5935839a Thomas Huehn 2014-09-09  302   if (mr->probability > MINSTREL_FRAC(75, 
100)) {
5935839a Thomas Huehn 2014-09-09  303           if (mr->cur_tp > tmp_tp)
5935839a Thomas Huehn 2014-09-09  304                   mi->max_prob_rate = 
index;
5935839a Thomas Huehn 2014-09-09  305           if (mr->cur_tp > 
mg->rates[mg->max_group_prob_rate].cur_tp)
5935839a Thomas Huehn 2014-09-09  306                   mg->max_group_prob_rate 
= index;
5935839a Thomas Huehn 2014-09-09  307   } else {
5935839a Thomas Huehn 2014-09-09  308           if (mr->probability > tmp_prob)
5935839a Thomas Huehn 2014-09-09  309                   mi->max_prob_rate = 
index;
5935839a Thomas Huehn 2014-09-09  310           if (mr->probability > 
mg->rates[mg->max_group_prob_rate].probability)
5935839a Thomas Huehn 2014-09-09  311                   mg->max_group_prob_rate 
= index;
5935839a Thomas Huehn 2014-09-09  312   }
5935839a Thomas Huehn 2014-09-09  313  }
5935839a Thomas Huehn 2014-09-09  314  
5935839a Thomas Huehn 2014-09-09  315  
5935839a Thomas Huehn 2014-09-09  316  /*
5935839a Thomas Huehn 2014-09-09  317   * Assign new rate set per sta and use 
CCK rates only if the fastest
5935839a Thomas Huehn 2014-09-09  318   * rate (max_tp_rate[0]) is from CCK 
group. This prohibits such sorted
5935839a Thomas Huehn 2014-09-09  319   * rate sets where MCS and CCK rates are 
mixed, because CCK rates can
5935839a Thomas Huehn 2014-09-09  320   * not use aggregation.
5935839a Thomas Huehn 2014-09-09  321   */
5935839a Thomas Huehn 2014-09-09  322  static void
5935839a Thomas Huehn 2014-09-09  323  minstrel_ht_assign_best_tp_rates(struct 
minstrel_ht_sta *mi,
d4d141ca Karl Beldan  2014-10-20  324                            u16 
tmp_mcs_tp_rate[MAX_THR_RATES],
d4d141ca Karl Beldan  2014-10-20  325                            u16 
tmp_cck_tp_rate[MAX_THR_RATES])
5935839a Thomas Huehn 2014-09-09  326  {
5935839a Thomas Huehn 2014-09-09  327   unsigned int tmp_group, tmp_idx, 
tmp_cck_tp, tmp_mcs_tp;
5935839a Thomas Huehn 2014-09-09  328   int i;
5935839a Thomas Huehn 2014-09-09  329  
5935839a Thomas Huehn 2014-09-09  330   tmp_group = tmp_cck_tp_rate[0] / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  331   tmp_idx = tmp_cck_tp_rate[0] % 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  332   tmp_cck_tp = 
mi->groups[tmp_group].rates[tmp_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  333  
5935839a Thomas Huehn 2014-09-09  334   tmp_group = tmp_mcs_tp_rate[0] / 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  335   tmp_idx = tmp_mcs_tp_rate[0] % 
MCS_GROUP_RATES;
5935839a Thomas Huehn 2014-09-09  336   tmp_mcs_tp = 
mi->groups[tmp_group].rates[tmp_idx].cur_tp;
5935839a Thomas Huehn 2014-09-09  337  
5935839a Thomas Huehn 2014-09-09  338   if (tmp_cck_tp > tmp_mcs_tp) {
5935839a Thomas Huehn 2014-09-09  339           for(i = 0; i < MAX_THR_RATES; 
i++) {
5935839a Thomas Huehn 2014-09-09 @340                   
minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i],
5935839a Thomas Huehn 2014-09-09  341                                           
       tmp_mcs_tp_rate);
5935839a Thomas Huehn 2014-09-09  342           }
5935839a Thomas Huehn 2014-09-09  343   }

:::::: The code at line 255 was first introduced by commit
:::::: 5935839ad73583781b8bbe8d91412f6826e218a4 mac80211: improve minstrel_ht 
rate sorting by throughput & probability

:::::: TO: Thomas Huehn <[email protected]>
:::::: CC: Johannes Berg <[email protected]>

---
0-DAY kernel test infrastructure                Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation
_______________________________________________
kbuild mailing list
[email protected]
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to