netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Phonet: Correct header retrieval after pskb_may_pull
@ 2010-09-28  9:10 Kumar A Sanghvi
  2010-09-28  9:47 ` Eric Dumazet
  2010-09-28 21:23 ` Rémi Denis-Courmont
  0 siblings, 2 replies; 4+ messages in thread
From: Kumar A Sanghvi @ 2010-09-28  9:10 UTC (permalink / raw)
  To: netdev, davem, remi.denis-courmont, eric.dumazet
  Cc: gulshan.karmani, Kumar Sanghvi, Linus Walleij

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]);
-- 
1.7.2.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Phonet: Correct header retrieval after pskb_may_pull
  2010-09-28  9:10 [PATCH] Phonet: Correct header retrieval after pskb_may_pull Kumar A Sanghvi
@ 2010-09-28  9:47 ` Eric Dumazet
  2010-09-28 21:23 ` Rémi Denis-Courmont
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-09-28  9:47 UTC (permalink / raw)
  To: Kumar A Sanghvi
  Cc: netdev, davem, remi.denis-courmont, gulshan.karmani,
	Linus Walleij

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>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Phonet: Correct header retrieval after pskb_may_pull
  2010-09-28  9:10 [PATCH] Phonet: Correct header retrieval after pskb_may_pull Kumar A Sanghvi
  2010-09-28  9:47 ` Eric Dumazet
@ 2010-09-28 21:23 ` Rémi Denis-Courmont
  2010-09-30  2:42   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Rémi Denis-Courmont @ 2010-09-28 21:23 UTC (permalink / raw)
  To: ext Kumar A Sanghvi
  Cc: netdev@vger.kernel.org, davem@davemloft.net,
	eric.dumazet@gmail.com, gulshan.karmani@stericsson.com,
	Linus Walleij

On Tuesday 28 September 2010 12:10:42 ext Kumar A Sanghvi, you wrote:
> 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: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Thanks!

-- 
Rémi Denis-Courmont
Nokia Devices R&D, Maemo Software, Helsinki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Phonet: Correct header retrieval after pskb_may_pull
  2010-09-28 21:23 ` Rémi Denis-Courmont
@ 2010-09-30  2:42   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-09-30  2:42 UTC (permalink / raw)
  To: remi.denis-courmont
  Cc: kumar.sanghvi, netdev, eric.dumazet, gulshan.karmani,
	linus.walleij

From: "Rémi Denis-Courmont" <remi.denis-courmont@nokia.com>
Date: Wed, 29 Sep 2010 00:23:44 +0300

> On Tuesday 28 September 2010 12:10:42 ext Kumar A Sanghvi, you wrote:
>> 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>
 ...
> Acked-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-30  2:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28  9:10 [PATCH] Phonet: Correct header retrieval after pskb_may_pull Kumar A Sanghvi
2010-09-28  9:47 ` Eric Dumazet
2010-09-28 21:23 ` Rémi Denis-Courmont
2010-09-30  2:42   ` David Miller

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).