aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback/netback.c
diff options
context:
space:
mode:
authorPaul Durrant <Paul.Durrant@citrix.com>2014-03-28 07:39:07 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-29 18:50:34 -0400
commit1425c7a4e8d3d2eebf308bcbdc3fa3c1247686b4 (patch)
tree47e3b3c92652e36d5b98db6c15f5df4a303a9863 /drivers/net/xen-netback/netback.c
parenta02eb4732cf975d7fc71b6d1a71c058c9988b949 (diff)
xen-netback: BUG_ON in xenvif_rx_action() not catching overflow
The BUG_ON to catch ring overflow in xenvif_rx_action() makes the assumption that meta_slots_used == ring slots used. This is not necessarily the case for GSO packets, because the non-prefix GSO protocol consumes one more ring slot than meta-slot for the 'extra_info'. This patch changes the test to actually check ring slots. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Cc: Sander Eikelenboom <linux@eikelenboom.it> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/netback.c')
-rw-r--r--drivers/net/xen-netback/netback.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 573f3e81e5d2..cd0bd95ccc14 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -482,6 +482,8 @@ static void xenvif_rx_action(struct xenvif *vif)
482 482
483 while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) { 483 while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) {
484 RING_IDX max_slots_needed; 484 RING_IDX max_slots_needed;
485 RING_IDX old_req_cons;
486 RING_IDX ring_slots_used;
485 int i; 487 int i;
486 488
487 /* We need a cheap worse case estimate for the number of 489 /* We need a cheap worse case estimate for the number of
@@ -530,8 +532,12 @@ static void xenvif_rx_action(struct xenvif *vif)
530 vif->rx_last_skb_slots = 0; 532 vif->rx_last_skb_slots = 0;
531 533
532 sco = (struct skb_cb_overlay *)skb->cb; 534 sco = (struct skb_cb_overlay *)skb->cb;
535
536 old_req_cons = vif->rx.req_cons;
533 sco->meta_slots_used = xenvif_gop_skb(skb, &npo); 537 sco->meta_slots_used = xenvif_gop_skb(skb, &npo);
534 BUG_ON(sco->meta_slots_used > max_slots_needed); 538 ring_slots_used = vif->rx.req_cons - old_req_cons;
539
540 BUG_ON(ring_slots_used > max_slots_needed);
535 541
536 __skb_queue_tail(&rxq, skb); 542 __skb_queue_tail(&rxq, skb);
537 } 543 }