From: Simon Graham Date: Thu, 24 May 2012 06:26:07 +0000 (+0000) Subject: xen/netback: Calculate the number of SKB slots required correctly X-Git-Tag: v2.6.39-400.9.0~516^2~20 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5176ff9409865862a6905db8c51804c75870d96c;p=users%2Fjedix%2Flinux-maple.git 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. Signed-off-by: Simon Graham Signed-off-by: David S. Miller (cherry picked from commit e26b203ede31fffd52571a5ba607a26c79dc5c0d) Signed-off-by: Joe Jin --- diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index a200af122653..2f31fd342c87 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -312,8 +312,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;