mac80211/minstrel: fix NULL pointer dereference issue
commit 5c9fc93bc9bc417418fc1b6366833ae6a07b804d upstream. When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move the assignment further down, after the rate_control_send_low call. Reported-by: Krzysztof Mazur <krzysiek@podlesie.net> Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c8942c6aac
commit
57fe9f79b9
@@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
|
||||
struct minstrel_rate *msr, *mr;
|
||||
unsigned int ndx;
|
||||
bool mrr_capable;
|
||||
bool prev_sample = mi->prev_sample;
|
||||
bool prev_sample;
|
||||
int delta;
|
||||
int sampling_ratio;
|
||||
|
||||
@@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
|
||||
(mi->sample_count + mi->sample_deferred / 2);
|
||||
|
||||
/* delta < 0: no sampling required */
|
||||
prev_sample = mi->prev_sample;
|
||||
mi->prev_sample = false;
|
||||
if (delta < 0 || (!mrr_capable && prev_sample))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user