summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ezchip
diff options
context:
space:
mode:
authorNoam Camus <noamc@ezchip.com>2015-08-20 08:00:02 +0300
committerDavid S. Miller <davem@davemloft.net>2015-08-23 16:08:53 -0700
commit93fcf83eb953d9ca2d3c51ff7f87095f0dd43511 (patch)
treea6b96b30ef7d072a8c9adc50c6276cfdf91facb3 /drivers/net/ethernet/ezchip
parent0dd20f3ce04e75521bd3f9867ecbc852ab348912 (diff)
NET: nps_enet: TX done race condition
We need to set tx_skb pointer before send frame. If we receive interrupt before we set pointer we will try to free SKB with wrong pointer. Now we are sure that SKB pointer will never be NULL during handling TX done and check is removed. Signed-off-by: Noam Camus <noamc@ezchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ezchip')
-rw-r--r--drivers/net/ethernet/ezchip/nps_enet.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 0e652b4fee8d..8b25f240943d 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -158,11 +158,7 @@ static void nps_enet_tx_handler(struct net_device *ndev)
ndev->stats.tx_bytes += tx_ctrl.nt;
}
- if (priv->tx_skb) {
- dev_kfree_skb(priv->tx_skb);
- priv->tx_skb = NULL;
- }
-
+ dev_kfree_skb(priv->tx_skb);
priv->tx_packet_sent = false;
if (netif_queue_stopped(ndev))
@@ -528,10 +524,10 @@ static netdev_tx_t nps_enet_start_xmit(struct sk_buff *skb,
/* This driver handles one frame at a time */
netif_stop_queue(ndev);
- nps_enet_send_frame(ndev, skb);
-
priv->tx_skb = skb;
+ nps_enet_send_frame(ndev, skb);
+
return NETDEV_TX_OK;
}