Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: alex.bluesman.smirnov@gmail.com
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2 net] 6lowpan: add missing pskb_may_pull() check
Date: Thu, 10 May 2012 15:30:59 +0200	[thread overview]
Message-ID: <1336656659.12504.153.camel@edumazet-glaptop> (raw)
In-Reply-To: <4fabc166.9208cc0a.4de8.ffff9211@mx.google.com>

On Thu, 2012-05-10 at 17:22 +0400, alex.bluesman.smirnov@gmail.com
wrote:
> From: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
> 
> Add pskb_may_pull() call when fetching u8 from skb.
> 
> Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
> ---
>  net/ieee802154/6lowpan.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
> index 32eb417..0ab3efe 100644
> --- a/net/ieee802154/6lowpan.c
> +++ b/net/ieee802154/6lowpan.c
> @@ -295,6 +295,8 @@ static u8 lowpan_fetch_skb_u8(struct sk_buff *skb)
>  {
>  	u8 ret;
>  
> +	BUG_ON(!pskb_may_pull(skb, 1));
> +
>  	ret = skb->data[0];
>  	skb_pull(skb, 1);
>  

No, you cant do that.

pskb_may_pull() can fail, and you crash your machine instead of graceful
error reporting.

  reply	other threads:[~2012-05-10 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1336656163-19382-1-git-send-email-y>
2012-05-10 13:22 ` [PATCH 1/2 net] 6lowpan: add missing pskb_may_pull() check alex.bluesman.smirnov
2012-05-10 13:30   ` Eric Dumazet [this message]
2012-05-10 14:05     ` Alexander Smirnov
2012-05-10 16:28       ` David Miller
2012-05-11 14:58   ` [PATCH 1/2 net v2] 6lowpan: rework data fetching from skb Alexander Smirnov
2012-05-13  3:28     ` David Miller
2012-05-10 13:22 ` [PATCH 2/2 net] 6lowpan: fix hop limit compression alex.bluesman.smirnov

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=1336656659.12504.153.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=alex.bluesman.smirnov@gmail.com \
    --cc=davem@davemloft.net \
    --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