public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Kumar A Sanghvi <kumar.sanghvi@stericsson.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	remi.denis-courmont@nokia.com, gulshan.karmani@stericsson.com,
	Linus Walleij <linus.walleij@stericsson.com>
Subject: Re: [PATCH] Phonet: Correct header retrieval after pskb_may_pull
Date: Tue, 28 Sep 2010 11:47:18 +0200	[thread overview]
Message-ID: <1285667238.3154.0.camel@edumazet-laptop> (raw)
In-Reply-To: <1285665042-20548-1-git-send-email-kumar.sanghvi@stericsson.com>

Le mardi 28 septembre 2010 à 14:40 +0530, Kumar A Sanghvi a écrit :
> From: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
> 
> Retrieve the header after doing pskb_may_pull since, pskb_may_pull
> could change the buffer structure.
> 
> This is based on the comment given by Eric Dumazet on Phonet
> Pipe controller patch for a similar problem.
> 
> Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
> ---
>  net/phonet/pep.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/net/phonet/pep.c b/net/phonet/pep.c
> index 7bf23cf..9746c6d 100644
> --- a/net/phonet/pep.c
> +++ b/net/phonet/pep.c
> @@ -507,12 +507,13 @@ static void pipe_grant_credits(struct sock *sk)
>  static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
>  {
>  	struct pep_sock *pn = pep_sk(sk);
> -	struct pnpipehdr *hdr = pnp_hdr(skb);
> +	struct pnpipehdr *hdr;
>  	int wake = 0;
>  
>  	if (!pskb_may_pull(skb, sizeof(*hdr) + 4))
>  		return -EINVAL;
>  
> +	hdr = pnp_hdr(skb);
>  	if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
>  		LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n",
>  				(unsigned)hdr->data[0]);

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>



  reply	other threads:[~2010-09-28  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  9:10 [PATCH] Phonet: Correct header retrieval after pskb_may_pull Kumar A Sanghvi
2010-09-28  9:47 ` Eric Dumazet [this message]
2010-09-28 21:23 ` Rémi Denis-Courmont
2010-09-30  2:42   ` 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=1285667238.3154.0.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gulshan.karmani@stericsson.com \
    --cc=kumar.sanghvi@stericsson.com \
    --cc=linus.walleij@stericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=remi.denis-courmont@nokia.com \
    /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