Skip to contentSkip to conversation

xen/netback: Calculate the number of SKB slots required correctly

PATCH Applied Simon Graham 3 participants 3 messages May 24, 2012 – May 28, 2012

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

PATCH 1/1 xen/netback: Calculate the number of SKB slots required correctly

When calculating the number of slots required for a packet header, the code was reserving too many slots if the header crossed a page boundary. Since netbk_gop_skb copies the header to the start of the page, the count of slots required for the header should be based solely on the header size.

This problem is easy to reproduce if a VIF is bridged to a USB 3G modem device as the skb->data value always starts near the end of the first page.

---
 drivers/net/xen-netback/netback.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/xen-netback/netback.c +1 -2
index 2596401..f4a6fca 100644
@@ -325,8 +325,7 @@ unsigned int xen_netbk_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
 	unsigned int count;
 	int i, copy_off;
 
-	count = DIV_ROUND_UP(
-			offset_in_page(skb->data)+skb_headlen(skb), PAGE_SIZE);
+	count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE);
 
 	copy_off = skb_headlen(skb) % PAGE_SIZE;
 
Signature · 1 line
1.7.9.1
maintainer Applied
#1 lore raw

From: Simon Graham <[email protected]>
Date: Thu, 24 May 2012 12:26:07 -0400

Quoted 9 lines

When calculating the number of slots required for a packet header, the code was reserving too many slots if the header crossed a page boundary. Since netbk_gop_skb copies the header to the start of the page, the count of slots required for the header should be based solely on the header size.

This problem is easy to reproduce if a VIF is bridged to a USB 3G modem device as the skb->data value always starts near the end of the first page.

Applied.

#2 lore raw
Quoted 8 lines · David Miller

From: Simon Graham <[email protected]>
Date: Thu, 24 May 2012 12:26:07 -0400

Quoted 5 lines

When calculating the number of slots required for a packet header, the code was reserving too many slots if the header crossed a page boundary. Since netbk_gop_skb copies the header to the start of the page, the count of slots required for the header should be based solely on the header size.

Quoted 6 lines
Quoted 4 lines

This problem is easy to reproduce if a VIF is bridged to a USB 3G modem device as the skb->data value always starts near the end of the first page.

Applied.

Thanks both!

Ian.