]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.3/sctp-remove-sched-init-from-sctp_stream_init.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 5.0.3 / sctp-remove-sched-init-from-sctp_stream_init.patch
1 From foo@baz Thu Mar 14 23:19:55 PDT 2019
2 From: Xin Long <lucien.xin@gmail.com>
3 Date: Fri, 8 Mar 2019 15:49:16 +0800
4 Subject: sctp: remove sched init from sctp_stream_init
5
6 From: Xin Long <lucien.xin@gmail.com>
7
8 [ Upstream commit 2e990dfd13974d9eae493006f42ffb48707970ef ]
9
10 syzbot reported a NULL-ptr deref caused by that sched->init() in
11 sctp_stream_init() set stream->rr_next = NULL.
12
13 kasan: GPF could be caused by NULL-ptr deref or user memory access
14 RIP: 0010:sctp_sched_rr_dequeue+0xd3/0x170 net/sctp/stream_sched_rr.c:141
15 Call Trace:
16 sctp_outq_dequeue_data net/sctp/outqueue.c:90 [inline]
17 sctp_outq_flush_data net/sctp/outqueue.c:1079 [inline]
18 sctp_outq_flush+0xba2/0x2790 net/sctp/outqueue.c:1205
19
20 All sched info is saved in sout->ext now, in sctp_stream_init()
21 sctp_stream_alloc_out() will not change it, there's no need to
22 call sched->init() again, since sctp_outq_init() has already
23 done it.
24
25 Fixes: 5bbbbe32a431 ("sctp: introduce stream scheduler foundations")
26 Reported-by: syzbot+4c9934f20522c0efd657@syzkaller.appspotmail.com
27 Signed-off-by: Xin Long <lucien.xin@gmail.com>
28 Acked-by: Neil Horman <nhorman@tuxdriver.com>
29 Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
30 Signed-off-by: David S. Miller <davem@davemloft.net>
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 ---
33 net/sctp/stream.c | 2 --
34 1 file changed, 2 deletions(-)
35
36 --- a/net/sctp/stream.c
37 +++ b/net/sctp/stream.c
38 @@ -230,8 +230,6 @@ int sctp_stream_init(struct sctp_stream
39 for (i = 0; i < stream->outcnt; i++)
40 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
41
42 - sched->init(stream);
43 -
44 in:
45 sctp_stream_interleave_init(stream);
46 if (!incnt)