summaryrefslogtreecommitdiffstats
path: root/package/madwifi/patches/331-memory_alloc.patch
blob: c18f6b4fd2924e85238d5d45210ecb7739e992dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- a/ath/if_ath.c
+++ b/ath/if_ath.c
@@ -3322,17 +3322,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
@@ -3603,6 +3604,8 @@
 	sc->sc_stats.ast_tx_mgmt++;
 	return 0;
 bad:
+	if (skb)
+		ieee80211_dev_kfree_skb(&skb);
 	ath_return_txbuf(sc, &bf);
 	return error;
 }