提交 73151ce3 编写于 作者: R Richard Cochran 提交者: David S. Miller

mv643xx_eth: fix race in trasmit path.

Because the socket buffer is freed in the completion interrupt, it is not
safe to access it after submitting it to the hardware.
Signed-off-by: NRichard Cochran <richard.cochran@omicron.at>
Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e00f85be
...@@ -859,7 +859,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb) ...@@ -859,7 +859,7 @@ static int txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev) static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct mv643xx_eth_private *mp = netdev_priv(dev); struct mv643xx_eth_private *mp = netdev_priv(dev);
int queue; int length, queue;
struct tx_queue *txq; struct tx_queue *txq;
struct netdev_queue *nq; struct netdev_queue *nq;
...@@ -881,10 +881,12 @@ static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -881,10 +881,12 @@ static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
length = skb->len;
if (!txq_submit_skb(txq, skb)) { if (!txq_submit_skb(txq, skb)) {
int entries_left; int entries_left;
txq->tx_bytes += skb->len; txq->tx_bytes += length;
txq->tx_packets++; txq->tx_packets++;
entries_left = txq->tx_ring_size - txq->tx_desc_count; entries_left = txq->tx_ring_size - txq->tx_desc_count;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册