Commit 10a273a6 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Jeff Garzik

xen-netfront: Avoid deref'ing skbafter it is potentially freed.

xennet_tx_bug_gc can free the skb before we use it, so make sure we don't.
Signed-off-by: default avatarKeir Fraser <keir@xensource.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent a6d89915
...@@ -566,6 +566,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -566,6 +566,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (notify) if (notify)
notify_remote_via_irq(np->netdev->irq); notify_remote_via_irq(np->netdev->irq);
np->stats.tx_bytes += skb->len;
np->stats.tx_packets++;
/* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
xennet_tx_buf_gc(dev); xennet_tx_buf_gc(dev);
if (!netfront_tx_slot_available(np)) if (!netfront_tx_slot_available(np))
...@@ -573,9 +577,6 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -573,9 +577,6 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_unlock_irq(&np->tx_lock); spin_unlock_irq(&np->tx_lock);
np->stats.tx_bytes += skb->len;
np->stats.tx_packets++;
return 0; return 0;
drop: drop:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment