Skip to contentSkip to conversation

mac80211: fix memory leak in ieee80211_send_probe_req

PATCH In review [email protected] 2 participants 5 messages Jan 15, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix memory leak in ieee80211_send_probe_req

From: Ming Lei <[email protected]>

This patch fixes memory leak in ieee80211_send_probe_req, which is introduced in 7c12ce8b854df346388ea56d684784e3484012cf:

mac80211: use Probe Request template when sending a direct scan

The patch is against the latest wireless-test tree.

---
 net/mac80211/util.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
net/mac80211/util.c +1 -0
index e278f97..ca170b4 100644
@@ -1028,6 +1028,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
 
 	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 	ieee80211_tx_skb(sdata, skb);
+	kfree(buf);
 }
 
 u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 6 lines · "ext [email protected]" <[email protected]> writes:

From: Ming Lei <[email protected]>

This patch fixes memory leak in ieee80211_send_probe_req, which is introduced in 7c12ce8b854df346388ea56d684784e3484012cf:

mac80211: use Probe Request template when sending a direct scan

Sorry, I introduced this bug. Thank you finding this.

Quoted 1 line

The patch is against the latest wireless-test tree.

You should add comments like this after the "---" line.

net/mac80211/util.c void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, · line 1031

Quoted 5 lines
net/mac80211/util.c +1 -0
@@ -1028,6 +1028,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
 
 	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 	ieee80211_tx_skb(sdata, skb);
+	kfree(buf);

Better to use dev_kfree_skb() here.

Can you resend, please?

Signature · 1 line
Kalle Valo
author
#2 lore raw

2010/1/15 Kalle Valo <[email protected]>:

Quoted 16 lines
Quoted 6 lines · "ext [email protected]" <[email protected]> writes:

From: Ming Lei <[email protected]>

This patch fixes memory leak in ieee80211_send_probe_req, which is introduced in 7c12ce8b854df346388ea56d684784e3484012cf:

      mac80211: use Probe Request template when sending a direct scan

Sorry, I introduced this bug. Thank you finding this.

Quoted 1 line

The patch is against the latest wireless-test tree.

You should add comments like this after the "---" line.

Quoted 7 lines

net/mac80211/util.c void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, · line 1031

Quoted 5 lines
net/mac80211/util.c +1 -0
@@ -1028,6 +1028,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
 
       IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
       ieee80211_tx_skb(sdata, skb);
+     kfree(buf);

Better to use dev_kfree_skb() here.

Why is dev_kfree_skb better?
It is 'buf' allocated in ieee80211_send_probe_req to be freed, not skb.

Quoted 2 lines

Can you resend, please?

OK.

Signature · 1 line
Lei Ming
Reviewed-by
#4 lore raw
In reply to Kalle Valo
Quoted 9 lines · Kalle Valo
Quoted 6 lines · "ext [email protected]" <[email protected]> writes:

From: Ming Lei <[email protected]>

This patch fixes memory leak in ieee80211_send_probe_req, which is introduced in 7c12ce8b854df346388ea56d684784e3484012cf:

mac80211: use Probe Request template when sending a direct scan

[...]

Quoted 7 lines

net/mac80211/util.c void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, · line 1031

Quoted 5 lines
net/mac80211/util.c +1 -0
@@ -1028,6 +1028,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
 
 	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
 	ieee80211_tx_skb(sdata, skb);
+	kfree(buf);

Better to use dev_kfree_skb() here.

I don't know what I was thinking when I sent the previous email :)

After second look, this looks good.

Signature · 1 line
Kalle Valo
#3 lore raw
In reply to Ming Lei
Quoted 8 lines · Ming Lei
Quoted 5 lines
Quoted 3 lines

      IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; ieee80211_tx_skb(sdata, skb);
+     kfree(buf);

Better to use dev_kfree_skb() here.

Why is dev_kfree_skb better?
It is 'buf' allocated in ieee80211_send_probe_req to be freed, not skb.

Yes, I misread your patch first. Please forget that comment :)

Signature · 1 line
Kalle Valo