Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: "'netdev@vger.kernel.org'" <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH V2] ipv6 mcast: Fix incorrect use of pskb_may_pull().
Date: Wed, 26 Dec 2012 08:03:12 -0800	[thread overview]
Message-ID: <1356537792.20133.20451.camel@edumazet-glaptop> (raw)
In-Reply-To: <50DA6B0D.6010500@linux-ipv6.org>

On Wed, 2012-12-26 at 12:12 +0900, YOSHIFUJI Hideaki wrote:
> pskb_may_pull(skb, len) ensures that len bytes from skb->data
> are available in a linear array.  When pskb_may_pull() is
> being used multiple times for the same buffer without
> skb_pull(), the length is not accumulated.
> 
> For example, assuming that we have done:
>   pskb_may_pull(skb, sizeof(struct icmp6hdr))
> 
> Here, we have to do:
>   pskb_may_pull(skb, sizeof(struct mld2_query))
> instead of:
>   pskb_may_pull(skb, sizeof(struct mld2_query) -
>                 sizeof(struct icmp6hdr))
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
>  net/ipv6/mcast.c |   13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 28dfa5f..5d91832 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -1124,7 +1124,7 @@ int igmp6_event_query(struct sk_buff *skb)
>  	int mark = 0;
>  	int len;
>  
> -	if (!pskb_may_pull(skb, sizeof(struct in6_addr)))
> +	if (!pskb_may_pull(skb, sizeof(struct icmp6hdr) + sizeof(struct in6_addr)))
>  		return -EINVAL;
>  

I am a bit confused by your patch.

igmp6_event_query() is called from icmpv6_rcv() _after_ 

pskb_pull(skb, sizeof(*hdr);

(hdr being struct icmp6hdr)

So this patch is wrong IMHO

  reply	other threads:[~2012-12-26 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-26  3:12 [PATCH V2] ipv6 mcast: Fix incorrect use of pskb_may_pull() YOSHIFUJI Hideaki
2012-12-26 16:03 ` Eric Dumazet [this message]
2012-12-26 16:40   ` YOSHIFUJI Hideaki

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=1356537792.20133.20451.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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