From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: xiaosuo@gmail.com, kaber@trash.net, pablo@netfilter.org,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: check the length of the data before dereferencing it
Date: Mon, 02 Apr 2012 05:45:45 +0200 [thread overview]
Message-ID: <1333338345.2325.6591.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120401.232942.1829187970291547571.davem@davemloft.net>
On Sun, 2012-04-01 at 23:29 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Mon, 02 Apr 2012 05:19:33 +0200
>
> >> @@ -3845,6 +3845,8 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
> >> length--;
> >> continue;
> >> default:
> >> + if (length < 2)
> >> + return;
> >> opsize = *ptr++;
> >> if (opsize < 2) /* "silly options" */
> >> return;
> >
> > Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Tag Eric, you're it.
>
> You ACK'd this patch, so you get to show how this is actually able
> to cause some kind of problem.
>
> I assert that this is adding a useless test, that doesn't fix any kind
> of possible crash or misbehavior. If length == 1 at the default:, the
> code will absolutely do the right thing.
>
> Prove me wrong.
No problem.
You can have NOP,NOP,NOP,EVIL-OPTION
initial length=4 (multiple of 4)
We can read 5 bytes, and access 'out of bound' memory.
Usually not a problem since we have many bytes after our head.
next prev parent reply other threads:[~2012-04-02 3:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 3:10 [PATCH] net: check the length of the data before dereferencing it Changli Gao
2012-04-02 3:19 ` Eric Dumazet
2012-04-02 3:29 ` David Miller
2012-04-02 3:45 ` Changli Gao
2012-04-02 3:53 ` Eric Dumazet
2012-04-02 3:57 ` David Miller
2012-04-02 3:59 ` Eric Dumazet
2012-04-02 4:47 ` Changli Gao
2012-04-02 4:54 ` Eric Dumazet
2012-04-02 6:27 ` Changli Gao
2012-04-02 6:43 ` Eric Dumazet
2012-04-02 3:45 ` Eric Dumazet [this message]
2012-04-02 3:55 ` David Miller
2012-04-02 3:58 ` Eric Dumazet
2012-04-02 4:14 ` David Miller
2012-04-02 3:19 ` 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=1333338345.2325.6591.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=xiaosuo@gmail.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