Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Eric Dumazet <eric.dumazet@gmail.com>,
	Anarcheuz Fritz <anarcheuz@gmail.com>
Cc: davem@davemloft.net, security@kernel.org, netdev@vger.kernel.org
Subject: Re: PROBLEM: null-ptr deref in ip_options_echo may lead to denial of service
Date: Tue, 21 Mar 2017 00:36:01 +0000	[thread overview]
Message-ID: <1490056561.4770.7.camel@decadent.org.uk> (raw)
In-Reply-To: <1490056423.4770.6.camel@decadent.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

On Tue, 2017-03-21 at 00:33 +0000, Ben Hutchings wrote:
> On Sun, 2017-03-19 at 22:25 -0700, Eric Dumazet wrote:
> > On Mon, 2017-03-20 at 12:59 +0800, Anarcheuz Fritz wrote:
> > > Hi David,
> > > 
> > > 
> > > While working on some legacy kernel I stumbled upon a null-ptr deref in
> > > ip_options_echo. The bug has been verified on the latest version
> > > 3.2.87 from the supported long-term branch.
> > > 
> > 
> > Fixed in commit 34b2cef20f19c87999fff3da4071e66937db9644
> > ("ipv4: keep skb->dst around in presence of IP options")
> > 
> > For 3.2, since d826eb14ecef was not backported, following patch should
> > do it.
> > 
> > (Bug origin was f84af32cbca70 ("net: ip_queue_rcv_skb() helper"))
> 
> I see, I thought the vulnerability was introduced by d826eb14ecef.
> 
> > diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> > index b3648bbef0da..a6e1eeb02267 100644
> > --- a/net/ipv4/ip_sockglue.c
> > +++ b/net/ipv4/ip_sockglue.c
> > @@ -1009,7 +1009,8 @@ e_inval:
> >   */
> >  int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> >  {
> > -	if (!(inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO))
> > +	if (!(inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) &&
> > +	    !IPCB(skb)->opt.optlen)
> >  		skb_dst_drop(skb);
> >  	return sock_queue_rcv_skb(sk, skb);
> >  }
> 
> Thanks to both of you; I'll queue this up for 3.2.

Actually, could I have a Signed-off-by for this, Eric?

Ben.

-- 
Ben Hutchings
Power corrupts.  Absolute power is kind of neat.
                           - John Lehman, Secretary of the US Navy
1981-1987


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-03-21  0:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  4:59 PROBLEM: null-ptr deref in ip_options_echo may lead to denial of service Anarcheuz Fritz
2017-03-20  5:25 ` Eric Dumazet
2017-03-21  0:33   ` Ben Hutchings
2017-03-21  0:36     ` Ben Hutchings [this message]
2017-03-21  4:23       ` [PATCH net-stable] ipv4: keep skb->dst around in presence of IP options Eric Dumazet
2017-03-21 11:25         ` Ben Hutchings
2017-03-21  4:24       ` PROBLEM: null-ptr deref in ip_options_echo may lead to denial of service Eric Dumazet

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=1490056561.4770.7.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=anarcheuz@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=security@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