From: Govindarajulu Varadarajan <govindarajulu90@gmail.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: Govindarajulu Varadarajan <govindarajulu90@gmail.com>
Subject: [PATCH net-next] net: sk_buff: memset(skb,0) after alloc in skb_clone
Date: Tue, 10 Sep 2013 10:18:53 +0530 [thread overview]
Message-ID: <1378788533-5609-1-git-send-email-govindarajulu90@gmail.com> (raw)
The following patch memset the skb to 0 after alloc. We do this in
__alloc_skb_head, __alloc_skb, build_skb. We are missing this in
skb_clone.
The following call to __skb_clone in skb_clone does not copy all the
members of sk_buff. If we donot clear the skb to 0, we will have some
uninitialized members in new skb.
Signed-off-by: Govindarajulu Varadarajan <govindarajulu90@gmail.com>
---
net/core/skbuff.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d81cff1..fc78f66 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -891,6 +891,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
if (!n)
return NULL;
+ memset(n, 0, offsetof(struct sk_buff, tail));
kmemcheck_annotate_bitfield(n, flags1);
kmemcheck_annotate_bitfield(n, flags2);
--
1.8.4
next reply other threads:[~2013-09-10 4:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 4:48 Govindarajulu Varadarajan [this message]
2013-09-10 12:40 ` [PATCH net-next] net: sk_buff: memset(skb,0) after alloc in skb_clone Eric Dumazet
2013-09-12 6:21 ` Govindarajulu Varadarajan
-- strict thread matches above, loose matches on Subject: below --
2013-09-10 6:33 Erik Hugne
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=1378788533-5609-1-git-send-email-govindarajulu90@gmail.com \
--to=govindarajulu90@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).