diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2012-07-16 22:05:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-18 12:40:54 -0400 |
commit | 02756ed4a79f15e4f265c1f6fbc634ce9966f153 (patch) | |
tree | de02844ec1d53bf8d269b5e5bf6fe6310df241ea | |
parent | 42f59967a091d012b358a532766fe4d53c6d3ba3 (diff) |
skbuff: Use correct allocation in skb_copy_ubufs
Use correct allocation flags during copy of user space fragments
to the kernel. Also "improve" couple of for loops.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/skbuff.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8b6d38fdb443..c011d7fab62d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -751,7 +751,7 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | |||
751 | u8 *vaddr; | 751 | u8 *vaddr; |
752 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; | 752 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; |
753 | 753 | ||
754 | page = alloc_page(GFP_ATOMIC); | 754 | page = alloc_page(gfp_mask); |
755 | if (!page) { | 755 | if (!page) { |
756 | while (head) { | 756 | while (head) { |
757 | struct page *next = (struct page *)head->private; | 757 | struct page *next = (struct page *)head->private; |
@@ -769,15 +769,15 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) | |||
769 | } | 769 | } |
770 | 770 | ||
771 | /* skb frags release userspace buffers */ | 771 | /* skb frags release userspace buffers */ |
772 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 772 | for (i = 0; i < num_frags; i++) |
773 | skb_frag_unref(skb, i); | 773 | skb_frag_unref(skb, i); |
774 | 774 | ||
775 | uarg->callback(uarg); | 775 | uarg->callback(uarg); |
776 | 776 | ||
777 | /* skb frags point to kernel buffers */ | 777 | /* skb frags point to kernel buffers */ |
778 | for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) { | 778 | for (i = num_frags - 1; i >= 0; i--) { |
779 | __skb_fill_page_desc(skb, i-1, head, 0, | 779 | __skb_fill_page_desc(skb, i, head, 0, |
780 | skb_shinfo(skb)->frags[i - 1].size); | 780 | skb_shinfo(skb)->frags[i].size); |
781 | head = (struct page *)head->private; | 781 | head = (struct page *)head->private; |
782 | } | 782 | } |
783 | 783 | ||