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