Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1425c7a4 authored by Paul Durrant's avatar Paul Durrant Committed by David S. Miller
Browse files

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: default avatarPaul 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: default avatarDavid S. Miller <davem@davemloft.net>
parent a02eb473
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -482,6 +482,8 @@ static void xenvif_rx_action(struct xenvif *vif)


	while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) {
	while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) {
		RING_IDX max_slots_needed;
		RING_IDX max_slots_needed;
		RING_IDX old_req_cons;
		RING_IDX ring_slots_used;
		int i;
		int i;


		/* We need a cheap worse case estimate for the number of
		/* We need a cheap worse case estimate for the number of
@@ -530,8 +532,12 @@ static void xenvif_rx_action(struct xenvif *vif)
			vif->rx_last_skb_slots = 0;
			vif->rx_last_skb_slots = 0;


		sco = (struct skb_cb_overlay *)skb->cb;
		sco = (struct skb_cb_overlay *)skb->cb;

		old_req_cons = vif->rx.req_cons;
		sco->meta_slots_used = xenvif_gop_skb(skb, &npo);
		sco->meta_slots_used = xenvif_gop_skb(skb, &npo);
		BUG_ON(sco->meta_slots_used > max_slots_needed);
		ring_slots_used = vif->rx.req_cons - old_req_cons;

		BUG_ON(ring_slots_used > max_slots_needed);


		__skb_queue_tail(&rxq, skb);
		__skb_queue_tail(&rxq, skb);
	}
	}