qlcnic: fix race in skb->len access.
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Thu, 14 Jul 2011 03:16:53 +0000 (03:16 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Jul 2011 15:49:44 +0000 (08:49 -0700)
As soon as skb is given to hardware, TX completion can free skb under us.
Therefore, we should update dev stats before kicking the device.

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic_main.c

index 916570db3aa4be87aad0c89bd6e5a3cc32fab5e5..006a693d49a78d203527547a819e7b9b747581fc 100644 (file)
@@ -2290,11 +2290,11 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        if (adapter->mac_learn)
                qlcnic_send_filter(adapter, tx_ring, first_desc, skb);
 
-       qlcnic_update_cmd_producer(adapter, tx_ring);
-
        adapter->stats.txbytes += skb->len;
        adapter->stats.xmitcalled++;
 
+       qlcnic_update_cmd_producer(adapter, tx_ring);
+
        return NETDEV_TX_OK;
 
 unwind_buff: