From: Krishna Kumar <krkumar2@in.ibm.com>
To: davem@davemloft.net
Cc: xma@us.ibm.com, netdev@vger.kernel.org,
Krishna Kumar <krkumar2@in.ibm.com>
Subject: [PATCH] skbuff: Use correct allocation in skb_copy_ubufs
Date: Tue, 17 Jul 2012 17:35:29 +0530 [thread overview]
Message-ID: <20120717120529.16840.51108.sendpatchset@localhost.localdomain> (raw)
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>
---
skbuff.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff -ruNp org/net/core/skbuff.c new/net/core/skbuff.c
--- org/net/core/skbuff.c 2012-07-17 09:56:12.000000000 +0530
+++ new/net/core/skbuff.c 2012-07-17 11:05:43.715853844 +0530
@@ -751,7 +751,7 @@ int skb_copy_ubufs(struct sk_buff *skb,
u8 *vaddr;
skb_frag_t *f = &skb_shinfo(skb)->frags[i];
- page = alloc_page(GFP_ATOMIC);
+ page = alloc_page(gfp_mask);
if (!page) {
while (head) {
struct page *next = (struct page *)head->private;
@@ -769,15 +769,15 @@ int skb_copy_ubufs(struct sk_buff *skb,
}
/* skb frags release userspace buffers */
- for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
+ for (i = 0; i < num_frags; i++)
skb_frag_unref(skb, i);
uarg->callback(uarg);
/* skb frags point to kernel buffers */
- for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) {
- __skb_fill_page_desc(skb, i-1, head, 0,
- skb_shinfo(skb)->frags[i - 1].size);
+ for (i = num_frags - 1; i >= 0; i--) {
+ __skb_fill_page_desc(skb, i, head, 0,
+ skb_shinfo(skb)->frags[i].size);
head = (struct page *)head->private;
}
next reply other threads:[~2012-07-17 12:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-17 12:05 Krishna Kumar [this message]
2012-07-18 16:45 ` [PATCH] skbuff: Use correct allocation in skb_copy_ubufs David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120717120529.16840.51108.sendpatchset@localhost.localdomain \
--to=krkumar2@in.ibm.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xma@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox