ath9k: fix a memory leak in ath_rx_tasklet()
authorEric Dumazet <[email protected]>
Thu, 15 Mar 2012 20:43:29 +0000 (13:43 -0700)
committerJohn W. Linville <[email protected]>
Mon, 26 Mar 2012 19:07:26 +0000 (15:07 -0400)
commit 0d95521ea7 (ath9k: use split rx buffers to get rid of order-1 skb
allocations) added in memory leak in error path.

sc->rx.frag should be cleared after the pskb_expand_head() call, or else
we jump to requeue_drop_frag and leak an skb.

Signed-off-by: Eric Dumazet <[email protected]>
Cc: Jouni Malinen <[email protected]>
Cc: Felix Fietkau <[email protected]>
Cc: John W. Linville <[email protected]>
Cc: Trond Wuellner <[email protected]>
Cc: Grant Grundler <[email protected]>
Cc: Paul Stewart <[email protected]>
Cc: David Miller <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
drivers/net/wireless/ath/ath9k/recv.c

index f4ae3ba994a8f85284cd157e227c8daeaf671b0c..1c4583c7ff7cffeba6ee39e1b04eefe43f71130f 100644 (file)
@@ -1913,13 +1913,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                if (sc->rx.frag) {
                        int space = skb->len - skb_tailroom(hdr_skb);
 
-                       sc->rx.frag = NULL;
-
                        if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) {
                                dev_kfree_skb(skb);
                                goto requeue_drop_frag;
                        }
 
+                       sc->rx.frag = NULL;
+
                        skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len),
                                                  skb->len);
                        dev_kfree_skb_any(skb);