]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: mvneta: fix race condition in mvneta_tx()
authorEric Dumazet <edumazet@google.com>
Tue, 2 Dec 2014 12:30:59 +0000 (04:30 -0800)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 15 Dec 2014 11:11:35 +0000 (11:11 +0000)
commit 5f478b41033606d325e420df693162e2524c2b94 upstream.

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>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/net/ethernet/marvell/mvneta.c

index 626aa88644b828409b3c5707778c7e1e2df4112d..393d49202f23e2e5ed4a75c2331b63adb5a0aeaf 100644 (file)
@@ -1719,6 +1719,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
        u16 txq_id = skb_get_queue_mapping(skb);
        struct mvneta_tx_queue *txq = &pp->txqs[txq_id];
        struct mvneta_tx_desc *tx_desc;
+       int len = skb->len;
        int frags = 0;
        u32 tx_cmd;
 
@@ -1786,7 +1787,7 @@ out:
 
                u64_stats_update_begin(&stats->syncp);
                stats->tx_packets++;
-               stats->tx_bytes  += skb->len;
+               stats->tx_bytes  += len;
                u64_stats_update_end(&stats->syncp);
        } else {
                dev->stats.tx_dropped++;