mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: 92siuyang@gmail.com
Cc: edumazet@google.com, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipv4: tcp_input: fix stack out of bounds when parsing TCP options.
Date: Thu, 30 May 2019 12:33:05 -0700 (PDT)	[thread overview]
Message-ID: <20190530.123305.679690617064301115.davem@davemloft.net> (raw)
In-Reply-To: <1559117459-27353-1-git-send-email-92siuyang@gmail.com>

From: Young Xiao <92siuyang@gmail.com>
Date: Wed, 29 May 2019 16:10:59 +0800

> The TCP option parsing routines in tcp_parse_options function could
> read one byte out of the buffer of the TCP options.
> 
> 1         while (length > 0) {
> 2                 int opcode = *ptr++;
> 3                 int opsize;
> 4
> 5                 switch (opcode) {
> 6                 case TCPOPT_EOL:
> 7                         return;
> 8                 case TCPOPT_NOP:        /* Ref: RFC 793 section 3.1 */
> 9                         length--;
> 10                        continue;
> 11                default:
> 12                        opsize = *ptr++; //out of bound access
> 
> If length = 1, then there is an access in line2.
> And another access is occurred in line 12.
> This would lead to out-of-bound access.
> 
> Therefore, in the patch we check that the available data length is
> larger enough to pase both TCP option code and size.
> 
> Signed-off-by: Young Xiao <92siuyang@gmail.com>

Applied.

      parent reply	other threads:[~2019-05-30 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  8:10 Young Xiao
2019-05-29 14:20 ` Eric Dumazet
2019-05-29 15:11   ` Yang Xiao
2019-05-29 15:44     ` Eric Dumazet
2019-05-30 19:33 ` David Miller [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=20190530.123305.679690617064301115.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=92siuyang@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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

all inboxes | Powered by JetHome®