aboutsummaryrefslogtreecommitdiffstats
path: root/package/madwifi/patches/331-memory_alloc.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-02-08 05:13:06 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-02-08 05:13:06 +0000
commitd5c5246c32b5075b40c19552a5d6b095c5191499 (patch)
treee2bf47fab592b6c855e4d980686f995d3ca0aa22 /package/madwifi/patches/331-memory_alloc.patch
parentf4012149b654c0ddfa0b6b3353c09ab9d3677bfc (diff)
downloadupstream-d5c5246c32b5075b40c19552a5d6b095c5191499.tar.gz
upstream-d5c5246c32b5075b40c19552a5d6b095c5191499.tar.bz2
upstream-d5c5246c32b5075b40c19552a5d6b095c5191499.zip
add a fix for memleaks caused by failed memory allocations
SVN-Revision: 10417
Diffstat (limited to 'package/madwifi/patches/331-memory_alloc.patch')
-rw-r--r--package/madwifi/patches/331-memory_alloc.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/package/madwifi/patches/331-memory_alloc.patch b/package/madwifi/patches/331-memory_alloc.patch
new file mode 100644
index 0000000000..2d218a4ec4
--- /dev/null
+++ b/package/madwifi/patches/331-memory_alloc.patch
@@ -0,0 +1,44 @@
+Index: madwifi-trunk-r3314/ath/if_ath.c
+===================================================================
+--- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-02-08 04:11:11.775823441 +0100
++++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-08 05:46:16.761139918 +0100
+@@ -3308,17 +3308,18 @@
+ * without affecting any other bridge ports. */
+ if (skb_cloned(skb)) {
+ /* Remember the original SKB so we can free up our references */
+- struct sk_buff *skb_orig = skb;
+- skb = skb_copy(skb, GFP_ATOMIC);
+- if (skb == NULL) {
++ struct sk_buff *skb_new;
++ skb_new = skb_copy(skb, GFP_ATOMIC);
++ if (skb_new == NULL) {
+ DPRINTF(sc, ATH_DEBUG_XMIT,
+ "Dropping; skb_copy failure.\n");
+ /* No free RAM, do not requeue! */
+ goto hardstart_fail;
+ }
+- ieee80211_skb_copy_noderef(skb_orig, skb);
+- ieee80211_dev_kfree_skb(&skb_orig);
+- }
++ ieee80211_skb_copy_noderef(skb, skb_new);
++ ieee80211_dev_kfree_skb(&skb);
++ skb = skb_new;
++ }
+ eh = (struct ether_header *)skb->data;
+
+ #ifdef ATH_SUPERG_FF
+@@ -3584,11 +3585,13 @@
+ */
+ error = ath_tx_start(dev, SKB_CB(skb)->ni, bf, skb, 0);
+ if (error)
+- goto bad;
++ return error;
+
+ sc->sc_stats.ast_tx_mgmt++;
+ return 0;
+ bad:
++ if (skb)
++ ieee80211_dev_kfree_skb(&skb);
+ ath_return_txbuf(sc, &bf);
+ return error;
+ }