Skip to content

Commit f7ff198

Browse files
Eric Dumazetdavem330
authored andcommitted
tg3: fix tigon3_dma_hwbug_workaround()
Ari got kernel panics using tg3 NIC, and bisected to 2669069 "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>
1 parent 580043a commit f7ff198

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/net/tg3.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6029,12 +6029,12 @@ static void tg3_tx_skb_unmap(struct tg3_napi *tnapi, u32 entry, int last)
60296029

60306030
/* Workaround 4GB and 40-bit hardware DMA bugs. */
60316031
static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
6032-
struct sk_buff *skb,
6032+
struct sk_buff **pskb,
60336033
u32 *entry, u32 *budget,
60346034
u32 base_flags, u32 mss, u32 vlan)
60356035
{
60366036
struct tg3 *tp = tnapi->tp;
6037-
struct sk_buff *new_skb;
6037+
struct sk_buff *new_skb, *skb = *pskb;
60386038
dma_addr_t new_addr = 0;
60396039
int ret = 0;
60406040

@@ -6076,7 +6076,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi,
60766076
}
60776077

60786078
dev_kfree_skb(skb);
6079-
6079+
*pskb = new_skb;
60806080
return ret;
60816081
}
60826082

@@ -6305,7 +6305,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
63056305
*/
63066306
entry = tnapi->tx_prod;
63076307
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,
63096309
base_flags, mss, vlan))
63106310
goto out_unlock;
63116311
}

0 commit comments

Comments
 (0)