From f127f4727f3f60359570b6daa136ac1156e38fbf Mon Sep 17 00:00:00 2001 From: Sucheta Chakraborty Date: Thu, 14 Jul 2011 03:16:53 +0000 Subject: [PATCH] qlcnic: fix race in skb->len access. 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 Signed-off-by: Amit Kumar Salecha Signed-off-by: David S. Miller --- drivers/net/qlcnic/qlcnic_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 916570db3aa4..006a693d49a7 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -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: -- 2.20.1