netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Xin Long <lucien.xin@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net] sctp: remove sched init from sctp_stream_init
Date: Fri, 8 Mar 2019 14:02:20 -0300	[thread overview]
Message-ID: <20190308170220.GE13515@localhost.localdomain> (raw)
In-Reply-To: <20190308122136.GA982@hmswarspite.think-freely.org>

On Fri, Mar 08, 2019 at 07:21:36AM -0500, Neil Horman wrote:
> On Fri, Mar 08, 2019 at 03:49:16PM +0800, Xin Long wrote:
> > syzbot reported a NULL-ptr deref caused by that sched->init() in
> > sctp_stream_init() set stream->rr_next = NULL.
> > 
> >   kasan: GPF could be caused by NULL-ptr deref or user memory access
> >   RIP: 0010:sctp_sched_rr_dequeue+0xd3/0x170 net/sctp/stream_sched_rr.c:141
> >   Call Trace:
> >     sctp_outq_dequeue_data net/sctp/outqueue.c:90 [inline]
> >     sctp_outq_flush_data net/sctp/outqueue.c:1079 [inline]
> >     sctp_outq_flush+0xba2/0x2790 net/sctp/outqueue.c:1205
> > 
> > All sched info is saved in sout->ext now, in sctp_stream_init()
> > sctp_stream_alloc_out() will not change it, there's no need to
> > call sched->init() again, since sctp_outq_init() has already
> > done it.

through sctp_sched_set_sched(), yes.  Thanks Xin.

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> > 
> > Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
> > Reported-by: syzbot+4c9934f20522c0efd657@syzkaller.appspotmail.com
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> > ---
> >  net/sctp/stream.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> > index 2936ed1..3b47457 100644
> > --- a/net/sctp/stream.c
> > +++ b/net/sctp/stream.c
> > @@ -230,8 +230,6 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt,
> >  	for (i = 0; i < stream->outcnt; i++)
> >  		SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
> >  
> > -	sched->init(stream);
> > -
> >  in:
> >  	sctp_stream_interleave_init(stream);
> >  	if (!incnt)
> > -- 
> > 2.1.0
> > 
> > 
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 

  reply	other threads:[~2019-03-08 17:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  7:49 [PATCH net] sctp: remove sched init from sctp_stream_init Xin Long
2019-03-08 12:21 ` Neil Horman
2019-03-08 17:02   ` Marcelo Ricardo Leitner [this message]
2019-03-08 19:25 ` 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=20190308170220.GE13515@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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).