public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] ipv6: check if dereference of ipv6 header is safe
Date: Thu, 17 Jan 2013 18:21:37 -0800	[thread overview]
Message-ID: <1358475697.11051.9.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130118020612.GA14833@order.stressinduktion.org>

On Fri, 2013-01-18 at 03:06 +0100, Hannes Frederic Sowa wrote:

> [PATCH] ipv6: remove unneeded check to pskb_may_pull
> 
> This is already checked by the caller (tunnel64_rcv) and brings ipip6_rcv
> in line with ipip_rcv.
> 
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
>  net/ipv6/sit.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index cfba99b..98fe536 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -592,15 +592,10 @@ out:
>  
>  static int ipip6_rcv(struct sk_buff *skb)
>  {
> -	const struct iphdr *iph;
> +	const struct iphdr *iph = ip_hdr(skb);
>  	struct ip_tunnel *tunnel;
>  	int err;
>  
> -	if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
> -		goto out;
> -
> -	iph = ip_hdr(skb);
> -
>  	tunnel = ipip6_tunnel_lookup(dev_net(skb->dev), skb->dev,
>  				     iph->saddr, iph->daddr);
>  	if (tunnel != NULL) {

But we use a 'struct iphdr' here, not a ipv6hdr

So we basically implicitely rely on sizeof(struct iphdr) <=
sizeof(struct ipv6hdr)

I would leave the pskb_may_pull() call and fix it, even if not really
needed.

  parent reply	other threads:[~2013-01-18  2:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17  3:56 [PATCH] ipv6: check if dereference of ipv6 header is safe Hannes Frederic Sowa
2013-01-18  2:06 ` Hannes Frederic Sowa
2013-01-18  2:08   ` David Miller
2013-01-18  2:21   ` Eric Dumazet [this message]
2013-01-18  3:08     ` Hannes Frederic Sowa
2013-01-18 19:12       ` Eric Dumazet

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=1358475697.11051.9.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=hannes@stressinduktion.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