From: Eric Dumazet <eric.dumazet@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: David Miller <davem@davemloft.net>,
bhutchings@solarflare.com, luis.henriques@canonical.com,
netdev@vger.kernel.org, jcliburn@gmail.com,
stable@vger.kernel.org
Subject: Re: [net PATCH] atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring
Date: Sun, 28 Jul 2013 13:08:33 -0700 [thread overview]
Message-ID: <1375042113.3669.40.camel@edumazet-glaptop> (raw)
In-Reply-To: <1375039316.3669.36.camel@edumazet-glaptop>
On Sun, 2013-07-28 at 12:21 -0700, Eric Dumazet wrote:
>
> btw, this driver leaks skb horribly in this error path :
>
> if (rrs->word3 & (RRS_RX_ERR_SUM | RRS_802_3_LEN_ERR)) {
> atl1c_clean_rfd(rfd_ring, rrs, rfd_num);
> if (netif_msg_rx_err(adapter))
> dev_warn(&pdev->dev,
> "wrong packet! rrs word3 is %x\n",
> rrs->word3);
> continue;
> }
Possible fix would be :
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 786a874..e815c23 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1729,11 +1729,16 @@ static void atl1c_clean_rfd(struct atl1c_rfd_ring *rfd_ring,
u16 i;
u16 rfd_index;
struct atl1c_buffer *buffer_info = rfd_ring->buffer_info;
+ struct sk_buff *skb;
rfd_index = (rrs->word0 >> RRS_RX_RFD_INDEX_SHIFT) &
RRS_RX_RFD_INDEX_MASK;
for (i = 0; i < num; i++) {
- buffer_info[rfd_index].skb = NULL;
+ skb = buffer_info[rfd_index].skb;
+ if (skb) {
+ kfree_skb(skb);
+ buffer_info[rfd_index].skb = NULL;
+ }
ATL1C_SET_BUFFER_STATE(&buffer_info[rfd_index],
ATL1C_BUFFER_FREE);
if (++rfd_index == rfd_ring->count)
@@ -1793,6 +1798,7 @@ rrs_checked:
pci_unmap_single(pdev, buffer_info->dma,
buffer_info->length, PCI_DMA_FROMDEVICE);
skb = buffer_info->skb;
+ buffer_info->skb = NULL;
} else {
/* TODO */
if (netif_msg_rx_err(adapter))
next prev parent reply other threads:[~2013-07-28 20:08 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-26 16:47 [net PATCH] atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring Neil Horman
2013-07-26 16:56 ` Luis Henriques
2013-07-26 17:02 ` Neil Horman
2013-07-26 22:56 ` David Miller
2013-07-27 16:25 ` Luis Henriques
2013-07-27 0:02 ` Ben Hutchings
2013-07-27 0:24 ` Ben Hutchings
2013-07-27 19:30 ` Luis Henriques
2013-07-27 19:49 ` Eric Dumazet
2013-07-27 21:30 ` Ben Hutchings
2013-07-27 23:59 ` Eric Dumazet
2013-07-28 3:02 ` David Miller
2013-07-28 10:44 ` Neil Horman
2013-07-28 16:15 ` Eric Dumazet
2013-07-28 18:53 ` Neil Horman
2013-07-28 19:21 ` Eric Dumazet
2013-07-28 20:08 ` Eric Dumazet [this message]
2013-07-28 20:22 ` Ben Hutchings
2013-07-28 23:01 ` Eric Dumazet
2013-07-28 23:20 ` Eric Dumazet
2013-07-28 23:25 ` Eric Dumazet
2013-07-28 23:38 ` Neil Horman
2013-07-29 0:07 ` Ben Hutchings
2013-07-29 0:21 ` David Miller
2013-07-29 0:26 ` Eric Dumazet
2013-07-29 9:55 ` Luis Henriques
2013-07-29 10:57 ` Eric Dumazet
2013-07-29 12:09 ` Luis Henriques
2013-07-29 15:30 ` Eric Dumazet
2013-07-29 17:24 ` Eric Dumazet
2013-07-30 8:53 ` Luis Henriques
2013-07-31 2:11 ` David Miller
2013-07-31 17:48 ` Benjamin Poirier
2013-07-31 17:56 ` Eric Dumazet
2013-07-31 19:01 ` David Miller
2013-08-01 1:57 ` 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=1375042113.3669.40.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=jcliburn@gmail.com \
--cc=luis.henriques@canonical.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=stable@vger.kernel.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