linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mac-hwsim:  don't leak memory on tx failure.
@ 2014-09-25 21:22 greearb
  2014-09-25 21:22 ` [PATCH 2/3] mac-hwsim: add ethtool stats support greearb
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: greearb @ 2014-09-25 21:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

It seems previous code did not properly clean up memory
if the packet could not be delivered to user-space.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

I don't have a good way to test this, but hopefully
it is correct.

 drivers/net/wireless/mac80211_hwsim.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index babbdc1..a74227d 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -862,7 +862,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
 	if (skb_queue_len(&data->pending) >= MAX_QUEUE) {
 		/* Droping until WARN_QUEUE level */
 		while (skb_queue_len(&data->pending) >= WARN_QUEUE)
-			skb_dequeue(&data->pending);
+			ieee80211_free_txskb(hw, skb_dequeue(&data->pending));
 	}
 
 	skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC);
@@ -921,6 +921,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
 
 nla_put_failure:
 	printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__);
+	ieee80211_free_txskb(hw, my_skb);
 }
 
 static bool hwsim_chans_compat(struct ieee80211_channel *c1,
-- 
1.7.11.7


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

end of thread, other threads:[~2014-10-09  9:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 21:22 [PATCH 1/3] mac-hwsim: don't leak memory on tx failure greearb
2014-09-25 21:22 ` [PATCH 2/3] mac-hwsim: add ethtool stats support greearb
2014-10-07  8:46   ` Johannes Berg
2014-10-07 13:48     ` Ben Greear
2014-10-09  9:44       ` Johannes Berg
2014-09-25 21:22 ` [PATCH 3/3] mac-hwsim: fix typo, remove un-needed goto greearb
2014-10-07  8:46 ` [PATCH 1/3] mac-hwsim: don't leak memory on tx failure 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).