Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Elmar Vonlanthen <evonlanthen@gmail.com>
Cc: linux-kernel@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	"Timo Teräs" <timo.teras@iki.fi>,
	"Herbert Xu" <herbert@gondor.apana.org.au>
Subject: Re: PROBLEM: System call 'sendmsg' of process ospfd (quagga) causes kernel oops
Date: Tue, 18 Oct 2011 04:30:32 +0200	[thread overview]
Message-ID: <1318905032.2571.35.camel@edumazet-laptop> (raw)
In-Reply-To: <CA+0Zf5A-8X5MaXC4+BbLKtMb8S8B-Ln_a3JNfz0jR4O-ruefuw@mail.gmail.com>

Le lundi 17 octobre 2011 à 09:16 +0200, Elmar Vonlanthen a écrit :
> 2011/10/14 Eric Dumazet <eric.dumazet@gmail.com>:
> > Please try following patch :
> >
> > [PATCH] ip_gre: dont increase dev->needed_headroom on a live device
> >
> > It seems ip_gre is able to change dev->needed_headroom on the fly.
> >
> > Its is not legal unfortunately and triggers a BUG in raw_sendmsg()
> >
> > skb = sock_alloc_send_skb(sk, ... + LL_ALLOCATED_SPACE(rt->dst.dev)
> >
> > < another cpu change dev->needed_headromm (making it bigger)
> >
> > ...
> > skb_reserve(skb, LL_RESERVED_SPACE(rt->dst.dev));
> >
> > We end with LL_RESERVED_SPACE() being bigger than LL_ALLOCATED_SPACE()
> > -> we crash later because skb head is exhausted.
> >
> > Bug introduced in commit 243aad83 in 2.6.34 (ip_gre: include route
> > header_len in max_headroom calculation)
> >
> > Reported-by: Elmar Vonlanthen <evonlanthen@gmail.com>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > CC: Timo Teräs <timo.teras@iki.fi>
> > CC: Herbert Xu <herbert@gondor.apana.org.au>
> > ---
> > diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> > index 8871067..1505dcf 100644
> > --- a/net/ipv4/ip_gre.c
> > +++ b/net/ipv4/ip_gre.c
> > @@ -835,8 +835,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
> >        if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
> >            (skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
> >                struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
> > -               if (max_headroom > dev->needed_headroom)
> > -                       dev->needed_headroom = max_headroom;
> >                if (!new_skb) {
> >                        ip_rt_put(rt);
> >                        dev->stats.tx_dropped++;
> 
> Hello
> 
> I tried this patch and I was not able anymore to reproduce the kernel
> oops. So the patch solved the bug.
> Thank you very much!
> 
> Would it be possible to add the patch to the long term kernel 2.6.35
> as well? Because this is the one I use at the moment in production.
> 

Thanks for testing.

If David/Herbert/Timo agree, then patch should find its way into current
kernel, then to stable trees as well.

Thanks

  reply	other threads:[~2011-10-18  2:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+0Zf5Be5JUSvssH9CrDQq=jtETZr=veAPC7jriM8B-FZKbbpg@mail.gmail.com>
2011-10-14 14:57 ` PROBLEM: System call 'sendmsg' of process ospfd (quagga) causes kernel oops Eric Dumazet
2011-10-17  7:16   ` Elmar Vonlanthen
2011-10-18  2:30     ` Eric Dumazet [this message]
2011-10-18  9:34       ` Herbert Xu
2011-10-18 10:01         ` Eric Dumazet
2011-10-18 10:05           ` Herbert Xu
2011-10-18 10:23             ` Eric Dumazet
2011-10-18 10:45               ` Herbert Xu
2011-10-18 11:37                 ` Eric Dumazet
2011-10-18 11:49                   ` Herbert Xu
2011-10-18 12:56                     ` Eric Dumazet
2011-10-18 13:45                       ` Herbert Xu
2011-10-19  7:09                         ` David Miller
2011-10-19  7:18                           ` Eric Dumazet
2011-10-19  7:30                             ` David Miller
2011-10-19  7:52                               ` Eric Dumazet
2011-10-19  8:02                                 ` David Miller
2011-10-19  8:08                               ` Herbert Xu
2011-10-20  9:30                                 ` David Miller
2011-10-20  9:35                                   ` Herbert Xu
2011-10-20 20:21                                     ` David Miller
2011-10-25 11:54                                     ` Herbert Xu
2011-10-26  3:12                                       ` David Miller
2011-11-18 12:18                                         ` [0/6] Replace LL_ALLOCATED_SPACE to allow needed_headroom adjustment Herbert Xu
2011-11-18 12:20                                           ` [PATCH 1/6] ipv4: Remove all uses of LL_ALLOCATED_SPACE Herbert Xu
2011-11-18 12:20                                           ` [PATCH 2/6] ipv6: " Herbert Xu
2011-11-18 12:20                                           ` [PATCH 3/6] net: " Herbert Xu
2011-11-18 12:20                                           ` [PATCH 5/6] packet: Add needed_tailroom to packet_sendmsg_spkt Herbert Xu
2011-11-18 12:20                                           ` [PATCH 4/6] net: Remove LL_ALLOCATED_SPACE Herbert Xu
2011-11-18 12:20                                           ` [PATCH 6/6] ip_gre: Set needed_headroom dynamically again Herbert Xu
2011-11-18 20:01                                           ` [0/6] Replace LL_ALLOCATED_SPACE to allow needed_headroom adjustment 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=1318905032.2571.35.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=evonlanthen@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=timo.teras@iki.fi \
    /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