Skip to content

Commit

Permalink
qlcnic: fix race in skb->len access.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sucheta Chakraborty authored and David S. Miller committed Jul 14, 2011
1 parent e5dcf6d commit f127f47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f127f47

Please sign in to comment.