madwifi patch cleanup and stability fixes - fix a semi-random heisenbug by replacing...
[openwrt/openwrt.git] / package / madwifi / patches / 331-memory_alloc.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -3320,17 +3320,18 @@
4 * without affecting any other bridge ports. */
5 if (skb_cloned(skb)) {
6 /* Remember the original SKB so we can free up our references */
7 - struct sk_buff *skb_orig = skb;
8 - skb = skb_copy(skb, GFP_ATOMIC);
9 - if (skb == NULL) {
10 + struct sk_buff *skb_new;
11 + skb_new = skb_copy(skb, GFP_ATOMIC);
12 + if (skb_new == NULL) {
13 DPRINTF(sc, ATH_DEBUG_XMIT,
14 "Dropping; skb_copy failure.\n");
15 /* No free RAM, do not requeue! */
16 goto hardstart_fail;
17 }
18 - ieee80211_skb_copy_noderef(skb_orig, skb);
19 - ieee80211_dev_kfree_skb(&skb_orig);
20 - }
21 + ieee80211_skb_copy_noderef(skb, skb_new);
22 + ieee80211_dev_kfree_skb(&skb);
23 + skb = skb_new;
24 + }
25 eh = (struct ether_header *)skb->data;
26
27 #ifdef ATH_SUPERG_FF
28 @@ -3601,6 +3602,8 @@
29 sc->sc_stats.ast_tx_mgmt++;
30 return 0;
31 bad:
32 + if (skb)
33 + ieee80211_dev_kfree_skb(&skb);
34 ath_return_txbuf(sc, &bf);
35 return error;
36 }