Commit 3a0233dd authored by Ross Lagerwall's avatar Ross Lagerwall Committed by David S. Miller

xen/netback: Reset nr_frags before freeing skb

At this point nr_frags has been incremented but the frag does not yet
have a page assigned so freeing the skb results in a crash. Reset
nr_frags before freeing the skb to prevent this.
Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 891584f4
...@@ -925,6 +925,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, ...@@ -925,6 +925,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS; skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS;
nskb = xenvif_alloc_skb(0); nskb = xenvif_alloc_skb(0);
if (unlikely(nskb == NULL)) { if (unlikely(nskb == NULL)) {
skb_shinfo(skb)->nr_frags = 0;
kfree_skb(skb); kfree_skb(skb);
xenvif_tx_err(queue, &txreq, extra_count, idx); xenvif_tx_err(queue, &txreq, extra_count, idx);
if (net_ratelimit()) if (net_ratelimit())
...@@ -940,6 +941,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, ...@@ -940,6 +941,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
if (xenvif_set_skb_gso(queue->vif, skb, gso)) { if (xenvif_set_skb_gso(queue->vif, skb, gso)) {
/* Failure in xenvif_set_skb_gso is fatal. */ /* Failure in xenvif_set_skb_gso is fatal. */
skb_shinfo(skb)->nr_frags = 0;
kfree_skb(skb); kfree_skb(skb);
kfree_skb(nskb); kfree_skb(nskb);
break; break;
......
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