[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1331844209.19406.11.camel@edumazet-glaptop>
Date: Thu, 15 Mar 2012 13:43:29 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: "John W. Linville" <linville@...driver.com>,
David Miller <davem@...emloft.net>
Cc: Jouni Malinen <jouni@....qualcomm.com>,
Felix Fietkau <nbd@...nwrt.org>,
Trond Wuellner <trond@...omium.org>,
Grant Grundler <grundler@...omium.org>,
Paul Stewart <pstew@...omium.org>,
netdev <netdev@...r.kernel.org>
Subject: [PATCH] ath9k: fix a memory leak in ath_rx_tasklet()
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 <eric.dumazet@...il.com>
Cc: Jouni Malinen <jouni@....qualcomm.com>
Cc: Felix Fietkau <nbd@...nwrt.org>
Cc: John W. Linville <linville@...driver.com>
Cc: Trond Wuellner <trond@...omium.org>
Cc: Grant Grundler <grundler@...omium.org>
Cc: Paul Stewart <pstew@...omium.org>
Cc: David Miller <davem@...emloft.net>
---
drivers/net/wireless/ath/ath9k/recv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 7e1a91a..e74fc99 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1917,13 +1917,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);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists