From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>,
Neil Horman <nhorman@tuxdriver.com>,
"David S. Miller" <davem@davemloft.net>,
linux-sctp@vger.kernel.org, netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller <syzkaller@googlegroups.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
Eric Dumazet <edumazet@google.com>,
Dmitry Vyukov <dvyukov@google.com>
Subject: Re: net/sctp: slab-out-of-bounds in sctp_sf_ootb
Date: Tue, 25 Oct 2016 10:33:39 -0200 [thread overview]
Message-ID: <20161025123339.GA4193@localhost.localdomain> (raw)
In-Reply-To: <CAAeHK+wSgHkk+pkTr+fp1jhA6XgaD+LoCmzAUWcdJKed=4A_PA@mail.gmail.com>
On Tue, Oct 25, 2016 at 02:23:48PM +0200, Andrey Konovalov wrote:
> Hi Marcelo,
>
> I can confirm that your patch fixes the issue for me.
>
> Tested-by: Andrey Konovalov <andreyknvl@google.com>
Great, thanks Andrey!
I'll post the patch in a few.
>
> On Mon, Oct 24, 2016 at 9:44 PM, Marcelo Ricardo Leitner
> <marcelo.leitner@gmail.com> wrote:
> > Hi Andrey,
> >
> > On Mon, Oct 24, 2016 at 05:30:04PM +0200, Andrey Konovalov wrote:
> >> The problem is that sctp_walk_errors walks the chunk before its length
> >> is checked for overflow.
> >
> > Exactly. The check is done too late, for the 2nd and subsequent chunks
> > only.
> > Please try the following patch, thanks. Note: not even compile tested.
> >
> > ---8<---
> >
> > diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> > index 026e3bca4a94..8ec20a64a3f8 100644
> > --- a/net/sctp/sm_statefuns.c
> > +++ b/net/sctp/sm_statefuns.c
> > @@ -3422,6 +3422,12 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
> > return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
> > commands);
> >
> > + /* Report violation if chunk len overflows */
> > + ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
> > + if (ch_end > skb_tail_pointer(skb))
> > + return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
> > + commands);
> > +
> > /* Now that we know we at least have a chunk header,
> > * do things that are type appropriate.
> > */
> > @@ -3453,12 +3459,6 @@ sctp_disposition_t sctp_sf_ootb(struct net *net,
> > }
> > }
> >
> > - /* Report violation if chunk len overflows */
> > - ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
> > - if (ch_end > skb_tail_pointer(skb))
> > - return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
> > - commands);
> > -
> > ch = (sctp_chunkhdr_t *) ch_end;
> > } while (ch_end < skb_tail_pointer(skb));
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2016-10-25 12:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 15:30 net/sctp: slab-out-of-bounds in sctp_sf_ootb Andrey Konovalov
2016-10-24 19:44 ` Marcelo Ricardo Leitner
2016-10-25 12:23 ` Andrey Konovalov
2016-10-25 12:33 ` Marcelo Ricardo Leitner [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=20161025123339.GA4193@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=andreyknvl@google.com \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=glider@google.com \
--cc=kcc@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=syzkaller@googlegroups.com \
--cc=vyasevich@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;
as well as URLs for NNTP newsgroup(s).