linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix a memory leak on sta rate selection table
@ 2014-05-23 17:29 Felix Fietkau
  2014-05-27 16:34 ` Ben Greear
  2014-05-27 17:55 ` Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: Felix Fietkau @ 2014-05-23 17:29 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, cprevotaux

Cc: stable@vger.kernel.org
Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 net/mac80211/sta_info.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 632d372..8b42f49 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -227,6 +227,7 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
  */
 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 {
+	struct ieee80211_sta_rates *rates;
 	int i;
 
 	if (sta->rate_ctrl)
@@ -238,6 +239,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
 		kfree(sta->tx_lat);
 	}
 
+	rates = rcu_dereference_protected(sta->sta.rates, true);
+	if (rates)
+		kfree(rates);
+
 	sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
 
 	kfree(sta);
-- 
1.8.5.2 (Apple Git-48)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix a memory leak on sta rate selection table
  2014-05-23 17:29 [PATCH] mac80211: fix a memory leak on sta rate selection table Felix Fietkau
@ 2014-05-27 16:34 ` Ben Greear
  2014-05-27 16:40   ` Christophe Prevotaux
  2014-05-27 17:55 ` Johannes Berg
  1 sibling, 1 reply; 6+ messages in thread
From: Ben Greear @ 2014-05-27 16:34 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, johannes, cprevotaux

On 05/23/2014 10:29 AM, Felix Fietkau wrote:
> Cc: stable@vger.kernel.org
> Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>

Any idea how far back this should be applied?

Thanks,
Ben

> ---
>  net/mac80211/sta_info.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index 632d372..8b42f49 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -227,6 +227,7 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
>   */
>  void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
>  {
> +	struct ieee80211_sta_rates *rates;
>  	int i;
>  
>  	if (sta->rate_ctrl)
> @@ -238,6 +239,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
>  		kfree(sta->tx_lat);
>  	}
>  
> +	rates = rcu_dereference_protected(sta->sta.rates, true);
> +	if (rates)
> +		kfree(rates);
> +
>  	sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
>  
>  	kfree(sta);
> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix a memory leak on sta rate selection table
  2014-05-27 16:34 ` Ben Greear
@ 2014-05-27 16:40   ` Christophe Prevotaux
  2014-05-27 17:01     ` Ben Greear
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Prevotaux @ 2014-05-27 16:40 UTC (permalink / raw)
  To: Ben Greear, Felix Fietkau
  Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net

Hi Ben,

In terms of OpenWRT world, at least backfire, did not go further back in 
checking. I suspect it is much older than this though :) But I did
put on my spelunking head lamp and I am afraid of the dark :)

Maybe Felix would know ?

Regards

Christophe

On 05/27/2014 06:34 PM, Ben Greear wrote:
> On 05/23/2014 10:29 AM, Felix Fietkau wrote:
>> Cc: stable@vger.kernel.org
>> Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
>> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
>
> Any idea how far back this should be applied?
>
> Thanks,
> Ben
>
>> ---
>>   net/mac80211/sta_info.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
>> index 632d372..8b42f49 100644
>> --- a/net/mac80211/sta_info.c
>> +++ b/net/mac80211/sta_info.c
>> @@ -227,6 +227,7 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
>>    */
>>   void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
>>   {
>> +	struct ieee80211_sta_rates *rates;
>>   	int i;
>>
>>   	if (sta->rate_ctrl)
>> @@ -238,6 +239,10 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
>>   		kfree(sta->tx_lat);
>>   	}
>>
>> +	rates = rcu_dereference_protected(sta->sta.rates, true);
>> +	if (rates)
>> +		kfree(rates);
>> +
>>   	sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
>>
>>   	kfree(sta);
>>
>
>


-- 
Christophe Prévotaux

cprevotaux@nltinc.com  +1 416 425 6559 [ext 240]

Northern Light Technologies
33 Laird Drive
M4G 3S9, Toronto, ON
Canada

http://www.nltinc.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix a memory leak on sta rate selection table
  2014-05-27 16:40   ` Christophe Prevotaux
@ 2014-05-27 17:01     ` Ben Greear
  2014-05-27 20:28       ` Felix Fietkau
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Greear @ 2014-05-27 17:01 UTC (permalink / raw)
  To: cprevotaux
  Cc: Felix Fietkau, linux-wireless@vger.kernel.org,
	johannes@sipsolutions.net

On 05/27/2014 09:40 AM, Christophe Prevotaux wrote:
> Hi Ben,
> 
> In terms of OpenWRT world, at least backfire, did not go further back in checking. I suspect it is much older than this though :) But I did
> put on my spelunking head lamp and I am afraid of the dark :)

A quick look makes me think it is at least not relevant to 3.9 kernels,
but I could be wrong about that.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix a memory leak on sta rate selection table
  2014-05-23 17:29 [PATCH] mac80211: fix a memory leak on sta rate selection table Felix Fietkau
  2014-05-27 16:34 ` Ben Greear
@ 2014-05-27 17:55 ` Johannes Berg
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2014-05-27 17:55 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, cprevotaux

On Fri, 2014-05-23 at 19:29 +0200, Felix Fietkau wrote:
> Cc: stable@vger.kernel.org
> Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>

As Ben said, a Fixes: line would be good - probably also needs Cc
stable.


> +	rates = rcu_dereference_protected(sta->sta.rates, true);
> +	if (rates)
> +		kfree(rates);

That seems like it should just be rcu_dereference_raw()? That's really
the same (it's a macro), but less verbose.

johannes


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix a memory leak on sta rate selection table
  2014-05-27 17:01     ` Ben Greear
@ 2014-05-27 20:28       ` Felix Fietkau
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2014-05-27 20:28 UTC (permalink / raw)
  To: Ben Greear, cprevotaux
  Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net

On 2014-05-27 19:01, Ben Greear wrote:
> On 05/27/2014 09:40 AM, Christophe Prevotaux wrote:
>> Hi Ben,
>> 
>> In terms of OpenWRT world, at least backfire, did not go further back in checking. I suspect it is much older than this though :) But I did
>> put on my spelunking head lamp and I am afraid of the dark :)
> 
> A quick look makes me think it is at least not relevant to 3.9 kernels,
> but I could be wrong about that.
Right, it applies to 3.10 and above.
Will resend with Cc stable.

- Felix


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-27 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 17:29 [PATCH] mac80211: fix a memory leak on sta rate selection table Felix Fietkau
2014-05-27 16:34 ` Ben Greear
2014-05-27 16:40   ` Christophe Prevotaux
2014-05-27 17:01     ` Ben Greear
2014-05-27 20:28       ` Felix Fietkau
2014-05-27 17:55 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).