netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH v2] ethernet: call __skb_pull() in eth_type_trans()
Date: Tue, 4 May 2010 10:05:22 +0800	[thread overview]
Message-ID: <w2l412e6f7f1005031905jf204b10ax67da6e9018ea81c4@mail.gmail.com> (raw)
In-Reply-To: <1272897886.2226.38.camel@edumazet-laptop>

On Mon, May 3, 2010 at 10:44 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> Hmm, I feel very uncompfortable with this patch.
>
> I am pretty sure some callers dont check minimum ethernet frame length.
>
> At least a WARN_ON_ONCE() is needed, just in case...
> In fact our stack has different requirements.
>
> Check net/ipv4/ip_gre.c for example.
>
>                if (tunnel->dev->type == ARPHRD_ETHER) {
>                        if (!pskb_may_pull(skb, ETH_HLEN)) {
>                                stats->rx_length_errors++;
>                                stats->rx_errors++;
>                                goto drop;
>                        }
>
>                        iph = ip_hdr(skb);
>                        skb->protocol = eth_type_trans(skb, tunnel->dev);
>                        skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
>                }
>

So the minimal packet length eth_type_trans() requires should be
ETH_HLEN, not ETH_ZLEN.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

  reply	other threads:[~2010-05-04  2:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 14:12 [PATCH v2] ethernet: call __skb_pull() in eth_type_trans() Changli Gao
2010-05-03 14:44 ` Eric Dumazet
2010-05-04  2:05   ` Changli Gao [this message]
2010-05-03 19:54 ` David Miller
2010-05-04  2:34   ` Changli Gao
2010-05-04  6:16     ` 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=w2l412e6f7f1005031905jf204b10ax67da6e9018ea81c4@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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).