From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: herbert@gondor.apana.org.au, daniel@iogearbox.net,
edumazet@google.com, davem@davemloft.net,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH RFC net-next] net: Assert napi_gro_cb size against skb->cb[]
Date: Fri, 31 Jul 2015 11:51:09 -0700 [thread overview]
Message-ID: <1438368669-659-1-git-send-email-f.fainelli@gmail.com> (raw)
On 64-bits hosts, napi_gro_cb is 48 bytes, which is exactly the size of
skb->cb[], while on 32-bits hosts it is 36 bytes, but if it were to
grow, we would not be catching a size inflation as we should.
Make sure that we have enough room for a napi_gro_cb to be hosted in
skb->cb[], and put this build-time assertion in skb_gro_reset_offset()
since this function is invoked by the GRO layers entry points.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/core/dev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 4870c3556a5a..20bc82604b75 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4115,6 +4115,8 @@ static void skb_gro_reset_offset(struct sk_buff *skb)
const struct skb_shared_info *pinfo = skb_shinfo(skb);
const skb_frag_t *frag0 = &pinfo->frags[0];
+ BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct napi_gro_cb));
+
NAPI_GRO_CB(skb)->data_offset = 0;
NAPI_GRO_CB(skb)->frag0 = NULL;
NAPI_GRO_CB(skb)->frag0_len = 0;
--
2.1.0
next reply other threads:[~2015-07-31 18:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 18:51 Florian Fainelli [this message]
2015-07-31 20:14 ` [PATCH RFC net-next] net: Assert napi_gro_cb size against skb->cb[] Tom Herbert
2015-07-31 20:24 ` Florian Westphal
2015-07-31 20:44 ` David Miller
2015-07-31 21:50 ` Florian Fainelli
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=1438368669-659-1-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--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).