mac80211/minstrel: fix NULL pointer dereference issue
PATCH 1/1 mac80211/minstrel: fix NULL pointer dereference issue
When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move the assignment further down, after the rate_control_send_low call.
--- net/mac80211/rc80211_minstrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/rc80211_minstrel.c +2 -1
@@ -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 ;
Signature · 1 line
1.8.0.2
Quoted 6 lines · Felix Fietkau
When
priv_sta== NULL,mi->prev_sampleis dereferenced too early. Move the assignment further down, after therate_control_send_lowcall.Reported-by Krzysztof Mazur <[email protected]>Cc [email protected] # 3.10Signed-off-by Felix Fietkau <[email protected]>
Why should this be marked for stable?
It's a local reference only, it's not used.
It's like suggesting that all the initialized
automatics should not be set until afterrate_control_set_low is called.
Quoted 25 lines
--- net/mac80211/rc80211_minstrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/mac80211/rc80211_minstrel.c +2
-1@@ -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 ;
Quoted 8 lines · Joe Perches
Quoted 6 lines · Felix Fietkau
When
priv_sta== NULL,mi->prev_sampleis dereferenced too early. Move the assignment further down, after therate_control_send_lowcall.Reported-by Krzysztof Mazur <[email protected]>Cc [email protected] # 3.10Signed-off-by Felix Fietkau <[email protected]>
Quoted 7 lines
Why should this be marked for stable?
It's a local reference only, it's not used.
It's like suggesting that all the initialized
automatics should not be set until afterrate_control_set_lowis called.
mi is set to priv_sta. It can be NULL. The case of priv_sta==NULL is caught by rate_control_send_low and causes it to bail out.
- Felix
Quoted 4 lines · Felix Fietkau
Quoted 3 lines · Joe Perches
Quoted 2 lines · Felix Fietkau
When
priv_sta== NULL,mi->prev_sampleis dereferenced too early. Move the assignment further down, after therate_control_send_lowcall.
[]
Quoted 2 lines
mi is set to
priv_sta. It can be NULL. The case of priv_sta==NULL is caught byrate_control_send_lowand causes it to bail out.
OK, thanks.
Quoted 9 lines · Felix Fietkau
When
priv_sta== NULL,mi->prev_sampleis dereferenced too early. Move the assignment further down, after therate_control_send_lowcall.Reported-by Krzysztof Mazur <[email protected]>Cc [email protected] # 3.10Signed-off-by Felix Fietkau <[email protected]>--- net/mac80211/rc80211_minstrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Works for me.
Thanks,
Krzysiek
Quoted 2 lines · Felix Fietkau
When
priv_sta== NULL,mi->prev_sampleis dereferenced too early. Move the assignment further down, after therate_control_send_lowcall.
Applied.
johannes