diff options
author | Eric Dumazet <edumazet@google.com> | 2014-12-02 07:30:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-08 20:55:36 -0500 |
commit | 5f478b41033606d325e420df693162e2524c2b94 (patch) | |
tree | 0ed69fd5adca03e94ad27abdd6d09c411ce4004b /drivers/net/ethernet/marvell | |
parent | aebea2ba0f7495e1a1c9ea5e753d146cb2f6b845 (diff) |
net: mvneta: fix race condition in mvneta_tx()
mvneta_tx() dereferences skb to get skb->len too late,
as hardware might have completed the transmit and TX completion
could have freed the skb from another cpu.
Fixes: 71f6d1b31fb1 ("net: mvneta: replace Tx timer with a real interrupt")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r-- | drivers/net/ethernet/marvell/mvneta.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index bb4afe6ccc85..67a84cfaefa1 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -1721,6 +1721,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) | |||
1721 | u16 txq_id = skb_get_queue_mapping(skb); | 1721 | u16 txq_id = skb_get_queue_mapping(skb); |
1722 | struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; | 1722 | struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; |
1723 | struct mvneta_tx_desc *tx_desc; | 1723 | struct mvneta_tx_desc *tx_desc; |
1724 | int len = skb->len; | ||
1724 | int frags = 0; | 1725 | int frags = 0; |
1725 | u32 tx_cmd; | 1726 | u32 tx_cmd; |
1726 | 1727 | ||
@@ -1788,7 +1789,7 @@ out: | |||
1788 | 1789 | ||
1789 | u64_stats_update_begin(&stats->syncp); | 1790 | u64_stats_update_begin(&stats->syncp); |
1790 | stats->tx_packets++; | 1791 | stats->tx_packets++; |
1791 | stats->tx_bytes += skb->len; | 1792 | stats->tx_bytes += len; |
1792 | u64_stats_update_end(&stats->syncp); | 1793 | u64_stats_update_end(&stats->syncp); |
1793 | } else { | 1794 | } else { |
1794 | dev->stats.tx_dropped++; | 1795 | dev->stats.tx_dropped++; |