liquidio: Avoid accessing skb after submitting to input queue
authorSatanand Burla <satananda.burla@cavium.com>
Thu, 26 Jan 2017 19:52:35 +0000 (11:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Jan 2017 20:42:18 +0000 (15:42 -0500)
Accessing skb after submitting to input queue can cause
access to stale pointers if the skb ends up being transmitted
and freed by that time.

Signed-off-by: Satanand Burla <satananda.burla@cavium.com>
Signed-off-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c

index 5ee3f007c613b1c1c9de541fc0b30b2e81f3930a..9261ddc0685238ff8882b021ab18bd88c12bbc6e 100644 (file)
@@ -3316,11 +3316,11 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
 
        netif_trans_update(netdev);
 
-       if (skb_shinfo(skb)->gso_size)
-               stats->tx_done += skb_shinfo(skb)->gso_segs;
+       if (tx_info->s.gso_segs)
+               stats->tx_done += tx_info->s.gso_segs;
        else
                stats->tx_done++;
-       stats->tx_tot_bytes += skb->len;
+       stats->tx_tot_bytes += ndata.datasize;
 
        return NETDEV_TX_OK;
 
index e96cf6cdecfd2bd5f733284e1d1b4f71b5d34353..a6587d7019ed5ad9aa7f73717e0435160816857d 100644 (file)
@@ -2433,11 +2433,11 @@ static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
 
        netif_trans_update(netdev);
 
-       if (skb_shinfo(skb)->gso_size)
-               stats->tx_done += skb_shinfo(skb)->gso_segs;
+       if (tx_info->s.gso_segs)
+               stats->tx_done += tx_info->s.gso_segs;
        else
                stats->tx_done++;
-       stats->tx_tot_bytes += skb->len;
+       stats->tx_tot_bytes += ndata.datasize;
 
        return NETDEV_TX_OK;