Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ramesh Nagappa <ramesh.nagappa@ericsson.com>
Cc: "ramesh.nagappa@gmail.com" <ramesh.nagappa@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"ebiederm@xmission.com" <ebiederm@xmission.com>,
	"xemul@parallels.com" <xemul@parallels.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] net: Fix skb_under_panic oops in neigh_resolve_output
Date: Fri, 05 Oct 2012 18:59:43 +0200	[thread overview]
Message-ID: <1349456383.21172.134.camel@edumazet-glaptop> (raw)
In-Reply-To: <CA3E5132752D1F49871ED0FC40D56BBA43ECF33592@EUSAACMS0701.eamcs.ericsson.se>

On Fri, 2012-10-05 at 12:33 -0400, Ramesh Nagappa wrote:
> Hi Eric,
> 
> Yes, that is a good optimization. neigh_resolve_output() also has the
> __skb_pull() outside the loop, is that required ? The changes would be
> like ...
> 
> neigh_resolve_output()
> ...
> -        __skb_pull(skb, skb_network_offset(skb));
> 
> 
>         if (!neigh_event_send(neigh, skb)) {
>                 int err;
>                 struct net_device *dev = neigh->dev;
>                 unsigned int seq;
> 
>                 if (dev->header_ops->cache && !neigh->hh.hh_len)
>                         neigh_hh_init(neigh, dst);
> 
>                 do {                        
> +			      __skb_pull(skb, skb_network_offset(skb));
>                         seq = read_seqbegin(&neigh->ha_lock);
>                         err = dev_hard_header(skb, dev, ntohs(skb->protocol),
>                                               neigh->ha, NULL, skb->len);
>                 } while (read_seqretry(&neigh->ha_lock, seq));

All similar constructions should be audited.

For example in net/decnet/dn_neigh.c , dn_neigh_output_packet()

      reply	other threads:[~2012-10-05 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05  3:05 [PATCH] net: Fix skb_under_panic oops in neigh_resolve_output ramesh.nagappa
2012-10-05  6:27 ` Eric Dumazet
2012-10-05 16:33   ` Ramesh Nagappa
2012-10-05 16:59     ` Eric Dumazet [this message]

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=1349456383.21172.134.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ramesh.nagappa@ericsson.com \
    --cc=ramesh.nagappa@gmail.com \
    --cc=xemul@parallels.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