mac80211: fix invalid read in minstrel_sort_best_tp_rates()
authorAdrien Schildknecht <adrien+dev@schischi.me>
Tue, 28 Jul 2015 08:30:16 +0000 (10:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 16:07:48 +0000 (09:07 -0700)
commit82cb8352e372319b2fc57bd6ed34c726a37fe24b
tree7b0f98812c32c2e76fe99413125027aa4504d6ef
parent360c2a1448754b76fbf742b6270f5da1d4db3700
mac80211: fix invalid read in minstrel_sort_best_tp_rates()

commit f5eeb5fa191fd7b634cbc4883ac58f3b2184dbc5 upstream.

At the last iteration of the loop, j may equal zero and thus
tp_list[j - 1] causes an invalid read.
Change the logic of the loop so that j - 1 is always >= 0.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mac80211/rc80211_minstrel.c