From: Eric Dumazet <eric.dumazet@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>,
David Miller <davem@davemloft.net>
Cc: Jouni Malinen <jouni@qca.qualcomm.com>,
Felix Fietkau <nbd@openwrt.org>,
Trond Wuellner <trond@chromium.org>,
Grant Grundler <grundler@chromium.org>,
Paul Stewart <pstew@chromium.org>,
netdev <netdev@vger.kernel.org>
Subject: [PATCH] ath9k: fix a memory leak in ath_rx_tasklet()
Date: Thu, 15 Mar 2012 13:43:29 -0700 [thread overview]
Message-ID: <1331844209.19406.11.camel@edumazet-glaptop> (raw)
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@gmail.com>
Cc: Jouni Malinen <jouni@qca.qualcomm.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Trond Wuellner <trond@chromium.org>
Cc: Grant Grundler <grundler@chromium.org>
Cc: Paul Stewart <pstew@chromium.org>
Cc: David Miller <davem@davemloft.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);
next reply other threads:[~2012-03-15 20:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-15 20:43 Eric Dumazet [this message]
2012-03-16 14:00 ` [PATCH] ath9k: fix a memory leak in ath_rx_tasklet() John W. Linville
2012-03-21 10:21 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331844209.19406.11.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=grundler@chromium.org \
--cc=jouni@qca.qualcomm.com \
--cc=linville@tuxdriver.com \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=pstew@chromium.org \
--cc=trond@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox