netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ebiederm@xmission.com
Cc: netdev@vger.kernel.org, linuxbugs@vittgam.net,
	security@kernel.org, greg@kroah.com, luto@amacapital.net,
	w@1wt.eu
Subject: Re: [PATCH net] ipv4: Avoid crashing in ip_error
Date: Fri, 22 May 2015 14:24:47 -0400 (EDT)	[thread overview]
Message-ID: <20150522.142447.1048811620866120127.davem@davemloft.net> (raw)
In-Reply-To: <87zj4x6iiz.fsf_-_@x220.int.ebiederm.org>

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Fri, 22 May 2015 04:58:12 -0500

> ip_error does not check if in_dev is NULL before dereferencing it.
> 
> IThe following sequence of calls is possible:
> CPU A                          CPU B
> ip_rcv_finish
>     ip_route_input_noref()
>         ip_route_input_slow()
>                                inetdev_destroy()
>     dst_input()
> 
> With the result that a network device can be destroyed while processing
> an input packet.
> 
> A crash was triggered with only unicast packets in flight, and
> forwarding enabled on the only network device.   The error condition
> was created by the removal of the network device.
> 
> As such it is likely the that error code was -EHOSTUNREACH, and the
> action taken by ip_error (if in_dev had been accessible) would have
> been to not increment any counters and to have tried and likely failed
> to send an icmp error as the network device is going away.
> 
> Therefore handle this weird case by just dropping the packet if
> !in_dev.  It will result in dropping the packet sooner, and will not
> result in an actual change of behavior.
> 
> Fixes: 251da4130115b ("ipv4: Cache ip_error() routes even when not forwarding.")
> Reported-by: "Vittorio G (VittGam)" <linuxbugs@vittgam.net>
> Tested-by: "Vittorio G (VittGam)" <linuxbugs@vittgam.net>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

Looks good, applied and queued up for -stable, thanks!

  parent reply	other threads:[~2015-05-22 18:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2b6d6ab2d8c35af3be55c82e507f5376@vittgam.net>
     [not found] ` <20150520025428.GA23304@kroah.com>
     [not found]   ` <b5abf7328b22373e4ec18bd6da479431@vittgam.net>
     [not found]     ` <06f5f10e9ee831f5a839c6ea24b94f64@vittgam.net>
     [not found]       ` <d146b8b8a69462ced89a384e6be85b28@vittgam.net>
     [not found]         ` <4cb068397127c2b2baee1f021b014b11@vittgam.net>
     [not found]           ` <da006bc9072931406270f0fdda06045d@vittgam.net>
     [not found]             ` <6056363be65a2c129551518da94bff20@vittgam.net>
     [not found]               ` <87a8wx97er.fsf@x220.int.ebiederm.org>
     [not found]                 ` <ff82713d6862786de9784bd3c9c06bfa@vittgam.net>
     [not found]                   ` <20150522040453.GC8530@1wt.eu>
2015-05-22  9:58                     ` [PATCH net] ipv4: Avoid crashing in ip_error Eric W. Biederman
2015-05-22 12:08                       ` Eric Dumazet
2015-05-22 15:12                         ` Vittorio G (VittGam)
2015-05-22 18:24                       ` David Miller [this message]
2015-05-22 18:48                         ` Vittorio G (VittGam)
2015-05-22 19:05                           ` David Miller
2015-05-22 19:17                             ` Vittorio G (VittGam)
2015-05-23  9:20                       ` Julian Anastasov
2015-05-23 14:40                         ` Eric W. Biederman
2015-05-23 16:59                           ` Vittorio G (VittGam)
2015-05-23 18:48                           ` Julian Anastasov
2015-05-23 21:09                             ` Eric Dumazet
2015-05-24 10:52                               ` Julian Anastasov

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=20150522.142447.1048811620866120127.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=linuxbugs@vittgam.net \
    --cc=luto@amacapital.net \
    --cc=netdev@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=w@1wt.eu \
    /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;
as well as URLs for NNTP newsgroup(s).