Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	David Ahern <dsahern@gmail.com>,
	syzbot <syzbot+91e6f9932ff122fa4410@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH net] ipv6: the entire IPv6 header chain must fit the first fragment
Date: Fri, 23 Mar 2018 06:24:54 -0700	[thread overview]
Message-ID: <5addc8ee-5faa-161f-6c91-f5481ddb0400@gmail.com> (raw)
In-Reply-To: <32b7e42bdb00fa809e7a04eedeae43004abe07eb.1521810295.git.pabeni@redhat.com>



On 03/23/2018 06:05 AM, Paolo Abeni wrote:
> While building ipv6 datagram we currently allow arbitrary large
> extheaders, even beyond pmtu size. The syzbot has found a way
> to exploit the above to trigger the following splat:
> 
... 
> As stated by RFC 7112 section 5:
> 
>    When a host fragments an IPv6 datagram, it MUST include the entire
>    IPv6 Header Chain in the First Fragment.
> 
> So this patch addresses the issue dropping datagrams with excessive
> extheader length. It also updates the error path to report to the
> calling socket nonnegative pmtu values.
> 
> The issue apparently predates git history.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: syzbot+91e6f9932ff122fa4410@syzkaller.appspotmail.com
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  net/ipv6/ip6_output.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 

> -				 sizeof(struct ipv6hdr));
> +		/* with large extheader pmtu can be negative, cap the reported
> +		 * value to 0, since it is unsigned
> +		 */
> +		pmtu = mtu + sizeof(struct ipv6hdr) > headersize ?
> +				  mtu - headersize + sizeof(struct ipv6hdr) : 0;

I would suggest :

pmtu = max_t(int, mtu - headersize + sizeof(struct ipv6hdr), 0);

And you can omit the comment, since the max_t() intent is obvious.

Thanks for working on this syzbot report.

      reply	other threads:[~2018-03-23 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23 13:05 [PATCH net] ipv6: the entire IPv6 header chain must fit the first fragment Paolo Abeni
2018-03-23 13:24 ` Eric Dumazet [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=5addc8ee-5faa-161f-6c91-f5481ddb0400@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+91e6f9932ff122fa4410@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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