Skip to content

Commit

Permalink
xen/netback: Calculate the number of SKB slots required correctly
Browse files Browse the repository at this point in the history
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 <simon.graham@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Simon Graham authored and David S. Miller committed May 24, 2012
1 parent b4bd8ad commit e26b203
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e26b203

Please sign in to comment.