* [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
@ 2013-07-15 12:35 Felix Fietkau
2013-07-15 12:50 ` Joe Perches
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Felix Fietkau @ 2013-07-15 12:35 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, krzysiek
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>
Cc: stable@vger.kernel.org # 3.10
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
net/mac80211/rc80211_minstrel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index ac7ef54..e6512e2 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -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;
--
1.8.0.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
2013-07-15 12:35 [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue Felix Fietkau
@ 2013-07-15 12:50 ` Joe Perches
2013-07-15 12:54 ` Felix Fietkau
2013-07-15 17:32 ` Krzysztof Mazur
2013-07-16 14:48 ` Johannes Berg
2 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-07-15 12:50 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, johannes, krzysiek
On Mon, 2013-07-15 at 14:35 +0200, Felix Fietkau wrote:
> 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>
> Cc: stable@vger.kernel.org # 3.10
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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 after
rate_control_set_low is called.
> ---
> net/mac80211/rc80211_minstrel.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
> index ac7ef54..e6512e2 100644
> --- a/net/mac80211/rc80211_minstrel.c
> +++ b/net/mac80211/rc80211_minstrel.c
> @@ -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;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
2013-07-15 12:50 ` Joe Perches
@ 2013-07-15 12:54 ` Felix Fietkau
2013-07-15 13:31 ` Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: Felix Fietkau @ 2013-07-15 12:54 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-wireless, johannes, krzysiek
On 2013-07-15 2:50 PM, Joe Perches wrote:
> On Mon, 2013-07-15 at 14:35 +0200, Felix Fietkau wrote:
>> 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>
>> Cc: stable@vger.kernel.org # 3.10
>> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
>
> 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 after
> rate_control_set_low is 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
2013-07-15 12:54 ` Felix Fietkau
@ 2013-07-15 13:31 ` Joe Perches
0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2013-07-15 13:31 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, johannes, krzysiek
On Mon, 2013-07-15 at 14:54 +0200, Felix Fietkau wrote:
> On 2013-07-15 2:50 PM, Joe Perches wrote:
> > On Mon, 2013-07-15 at 14:35 +0200, Felix Fietkau wrote:
> >> When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move
> >> the assignment further down, after the rate_control_send_low call.
[]
> 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.
OK, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
2013-07-15 12:35 [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue Felix Fietkau
2013-07-15 12:50 ` Joe Perches
@ 2013-07-15 17:32 ` Krzysztof Mazur
2013-07-16 14:48 ` Johannes Berg
2 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Mazur @ 2013-07-15 17:32 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, johannes
On Mon, Jul 15, 2013 at 02:35:06PM +0200, Felix Fietkau wrote:
> 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>
> Cc: stable@vger.kernel.org # 3.10
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> ---
> net/mac80211/rc80211_minstrel.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Works for me.
Thanks,
Krzysiek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue
2013-07-15 12:35 [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue Felix Fietkau
2013-07-15 12:50 ` Joe Perches
2013-07-15 17:32 ` Krzysztof Mazur
@ 2013-07-16 14:48 ` Johannes Berg
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2013-07-16 14:48 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, krzysiek
On 2013-07-15 15:35, Felix Fietkau wrote:
> When priv_sta == NULL, mi->prev_sample is dereferenced too early. Move
> the assignment further down, after the rate_control_send_low call.
Applied.
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-07-16 14:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 12:35 [PATCH 3.11] mac80211/minstrel: fix NULL pointer dereference issue Felix Fietkau
2013-07-15 12:50 ` Joe Perches
2013-07-15 12:54 ` Felix Fietkau
2013-07-15 13:31 ` Joe Perches
2013-07-15 17:32 ` Krzysztof Mazur
2013-07-16 14:48 ` Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.