All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sctp: remove sched init from sctp_stream_init
@ 2019-03-08  7:49 ` Xin Long
  0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2019-03-08  7:49 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

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.

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net] sctp: remove sched init from sctp_stream_init
@ 2019-03-08  7:49 ` Xin Long
  0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2019-03-08  7:49 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

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.

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
  2019-03-08  7:49 ` Xin Long
@ 2019-03-08 12:21   ` Neil Horman
  -1 siblings, 0 replies; 8+ messages in thread
From: Neil Horman @ 2019-03-08 12:21 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

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.
> 
> 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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
@ 2019-03-08 12:21   ` Neil Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Horman @ 2019-03-08 12:21 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

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.
> 
> 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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
  2019-03-08 12:21   ` Neil Horman
@ 2019-03-08 17:02     ` Marcelo Ricardo Leitner
  -1 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2019-03-08 17:02 UTC (permalink / raw)
  To: Neil Horman; +Cc: Xin Long, network dev, linux-sctp, davem

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>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
@ 2019-03-08 17:02     ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2019-03-08 17:02 UTC (permalink / raw)
  To: Neil Horman; +Cc: Xin Long, network dev, linux-sctp, davem

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>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
  2019-03-08  7:49 ` Xin Long
@ 2019-03-08 19:25   ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-03-08 19:25 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Fri,  8 Mar 2019 15:49:16 +0800

> 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.
> 
> Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
> Reported-by: syzbot+4c9934f20522c0efd657@syzkaller.appspotmail.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net] sctp: remove sched init from sctp_stream_init
@ 2019-03-08 19:25   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-03-08 19:25 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Fri,  8 Mar 2019 15:49:16 +0800

> 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.
> 
> Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
> Reported-by: syzbot+4c9934f20522c0efd657@syzkaller.appspotmail.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-03-08 19:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  7:49 [PATCH net] sctp: remove sched init from sctp_stream_init Xin Long
2019-03-08  7:49 ` Xin Long
2019-03-08 12:21 ` Neil Horman
2019-03-08 12:21   ` Neil Horman
2019-03-08 17:02   ` Marcelo Ricardo Leitner
2019-03-08 17:02     ` Marcelo Ricardo Leitner
2019-03-08 19:25 ` David Miller
2019-03-08 19:25   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.