From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Oostdyk <daveo@ll.mit.edu>, ecashin@coraid.com
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH] aoe: reserve enough headroom on skbs
Date: Wed, 27 Mar 2013 21:28:41 -0700 [thread overview]
Message-ID: <1364444921.15753.32.camel@edumazet-glaptop> (raw)
In-Reply-To: <5153C2E8.6050604@ll.mit.edu>
From: Eric Dumazet <edumazet@google.com>
Some network drivers use a non default hard_header_len
Transmitted skb should take into account dev->hard_header_len, or risk
crashes or expensive reallocations.
In the case of aoe, lets reserve MAX_HEADER bytes.
David reported a crash in defxx driver, solved by this patch.
Reported-by: David Oostdyk <daveo@ll.mit.edu>
Tested-by: David Oostdyk <daveo@ll.mit.edu>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ed Cashin <ecashin@coraid.com>
---
drivers/block/aoe/aoecmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 25ef5c0..92b6d7c 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -51,8 +51,9 @@ new_skb(ulong len)
{
struct sk_buff *skb;
- skb = alloc_skb(len, GFP_ATOMIC);
+ skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC);
if (skb) {
+ skb_reserve(skb, MAX_HEADER);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb->protocol = __constant_htons(ETH_P_AOE);
next prev parent reply other threads:[~2013-03-28 4:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 14:29 defxx: skb_push() failing? David Oostdyk
2013-03-26 15:15 ` Eric Dumazet
2013-03-26 16:03 ` David Oostdyk
2013-03-26 16:30 ` Eric Dumazet
2013-03-26 18:45 ` David Oostdyk
2013-03-26 19:00 ` Maciej W. Rozycki
2013-03-28 4:11 ` David Oostdyk
2013-03-28 4:28 ` Eric Dumazet [this message]
2013-03-28 18:30 ` [PATCH] aoe: reserve enough headroom on skbs 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=1364444921.15753.32.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=daveo@ll.mit.edu \
--cc=ecashin@coraid.com \
--cc=macro@linux-mips.org \
--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