Commit 2ffe53f9 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jiri Slaby

net: mvneta: fix race condition in mvneta_tx()

[ Upstream commit 5f478b41 ]

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: 71f6d1b3 ("net: mvneta: replace Tx timer with a real interrupt")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 84496965
...@@ -1524,6 +1524,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -1524,6 +1524,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
struct mvneta_tx_queue *txq = &pp->txqs[txq_id]; struct mvneta_tx_queue *txq = &pp->txqs[txq_id];
struct mvneta_tx_desc *tx_desc; struct mvneta_tx_desc *tx_desc;
struct netdev_queue *nq; struct netdev_queue *nq;
int len = skb->len;
int frags = 0; int frags = 0;
u32 tx_cmd; u32 tx_cmd;
...@@ -1584,7 +1585,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -1584,7 +1585,7 @@ static int mvneta_tx(struct sk_buff *skb, struct net_device *dev)
if (frags > 0) { if (frags > 0) {
u64_stats_update_begin(&pp->tx_stats.syncp); u64_stats_update_begin(&pp->tx_stats.syncp);
pp->tx_stats.packets++; pp->tx_stats.packets++;
pp->tx_stats.bytes += skb->len; pp->tx_stats.bytes += len;
u64_stats_update_end(&pp->tx_stats.syncp); u64_stats_update_end(&pp->tx_stats.syncp);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment