aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-10-22 03:29:53 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-22 03:29:53 -0400
commitf7ff19871bb4a3451e1ca2cf660bf633018cfbec (patch)
treeffbbfd627d08f90774be98ad8c0e33fb4f732974 /drivers
parent580043a27da2bd8201ee321a0d5550c629fcab8d (diff)
tg3: fix tigon3_dma_hwbug_workaround()
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/tg3.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index c11a2b8327f3..d469004704ad 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)
6029 6029
6030/* Workaround 4GB and 40-bit hardware DMA bugs. */ 6030/* Workaround 4GB and 40-bit hardware DMA bugs. */
6031static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, 6031static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
6032 struct sk_buff *skb, 6032 struct sk_buff **pskb,
6033 u32 *entry, u32 *budget, 6033 u32 *entry, u32 *budget,
6034 u32 base_flags, u32 mss, u32 vlan) 6034 u32 base_flags, u32 mss, u32 vlan)
6035{ 6035{
6036 struct tg3 *tp = tnapi->tp; 6036 struct tg3 *tp = tnapi->tp;
6037 struct sk_buff *new_skb; 6037 struct sk_buff *new_skb, *skb = *pskb;
6038 dma_addr_t new_addr = 0; 6038 dma_addr_t new_addr = 0;
6039 int ret = 0; 6039 int ret = 0;
6040 6040
@@ -6076,7 +6076,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
6076 } 6076 }
6077 6077
6078 dev_kfree_skb(skb); 6078 dev_kfree_skb(skb);
6079 6079 *pskb = new_skb;
6080 return ret; 6080 return ret;
6081} 6081}
6082 6082
@@ -6305,7 +6305,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
6305 */ 6305 */
6306 entry = tnapi->tx_prod; 6306 entry = tnapi->tx_prod;
6307 budget = tg3_tx_avail(tnapi); 6307 budget = tg3_tx_avail(tnapi);
6308 if (tigon3_dma_hwbug_workaround(tnapi, skb, &entry, &budget, 6308 if (tigon3_dma_hwbug_workaround(tnapi, &skb, &entry, &budget,
6309 base_flags, mss, vlan)) 6309 base_flags, mss, vlan))
6310 goto out_unlock; 6310 goto out_unlock;
6311 } 6311 }