From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ari Savolainen <ari.m.savolainen@gmail.com>
Cc: RongQing Li <roy.qing.li@gmail.com>,
David Miller <davem@davemloft.net>,
richardcochran@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] tg3: fix tigon3_dma_hwbug_workaround()
Date: Sat, 22 Oct 2011 09:25:38 +0200 [thread overview]
Message-ID: <1319268338.6180.20.camel@edumazet-laptop> (raw)
In-Reply-To: <1319265470.6180.13.camel@edumazet-laptop>
Ari got kernel panics using tg3 NIC, and bisected to 2669069aacc9 "tg3:
enable transmit time stamping."
This is because tigon3_dma_hwbug_workaround() might alloc a new skb and
free the original. We panic when skb_tx_timestamp() is called on freed
skb.
Reported-by: Ari Savolainen <ari.m.savolainen@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
drivers/net/tg3.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4a1374d..6149dc5 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6029,12 +6029,12 @@ static void tg3_tx_skb_unmap(struct tg3_napi *tnapi, u32 entry, int last)
/* Workaround 4GB and 40-bit hardware DMA bugs. */
static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
- struct sk_buff *skb,
+ struct sk_buff **pskb,
u32 *entry, u32 *budget,
u32 base_flags, u32 mss, u32 vlan)
{
struct tg3 *tp = tnapi->tp;
- struct sk_buff *new_skb;
+ struct sk_buff *new_skb, *skb = *pskb;
dma_addr_t new_addr = 0;
int ret = 0;
@@ -6076,7 +6076,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
}
dev_kfree_skb(skb);
-
+ *pskb = new_skb;
return ret;
}
@@ -6305,7 +6305,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/
entry = tnapi->tx_prod;
budget = tg3_tx_avail(tnapi);
- if (tigon3_dma_hwbug_workaround(tnapi, skb, &entry, &budget,
+ if (tigon3_dma_hwbug_workaround(tnapi, &skb, &entry, &budget,
base_flags, mss, vlan))
goto out_unlock;
}
next prev parent reply other threads:[~2011-10-22 7:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-15 7:50 Kernel panic from tg3 net driver Ari Savolainen
2011-10-20 19:30 ` Ari Savolainen
2011-10-20 19:56 ` David Miller
2011-10-20 20:05 ` Eric Dumazet
2011-10-20 20:11 ` David Miller
2011-10-20 20:17 ` Eric Dumazet
2011-10-20 20:37 ` Ari Savolainen
2011-10-21 10:48 ` RongQing Li
2011-10-22 6:12 ` Ari Savolainen
2011-10-22 6:37 ` Eric Dumazet
2011-10-22 7:25 ` Eric Dumazet [this message]
2011-10-22 7:30 ` [PATCH] tg3: fix tigon3_dma_hwbug_workaround() David Miller
2011-10-22 7:54 ` Ari Savolainen
2011-10-22 13:30 ` Ari Savolainen
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=1319268338.6180.20.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=ari.m.savolainen@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=roy.qing.li@gmail.com \
/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