Skip to contentSkip to conversation

liquidio: Avoid accessing skb after submitting to input queue

PATCH Applied Felix Manlunas 2 participants 2 messages Jan 26, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 liquidio: Avoid accessing skb after submitting to input queue

From: Satanand Burla <[email protected]>

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.

---
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 6 +++---
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_main.c +3 -3
index 5ee3f00..9261ddc 100644
@@ -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;
 
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +3 -3
index e96cf6c..a6587d7 100644
@@ -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;
maintainer Applied
#1 lore raw

From: Felix Manlunas <[email protected]>
Date: Thu, 26 Jan 2017 11:52:35 -0800

Quoted 10 lines

From: Satanand Burla <[email protected]>

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.

Applied, thanks.