Subject: BUG: unable to handle kernel NULL pointer dereference in sctp_stream_free

From: syzbot <[email-masked]>
Date: Wed, 20 Dec 2017 12:51:01 -0800

Hello,

syzkaller hit the following crash on  
6084b576dca2e898f5c101baef151f7bfdbb606d
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

Unfortunately, I don't have any reproducer for this bug yet.

RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000452a09
RDX: 0000000000000010 RSI: 00000000200ba000 RDI: 0000000000000013
RBP: 000000000000004e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006ed7f0
R13: 0000000000000014 R14: 000000000071bf00 R15: ffffffffffffffff
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: sctp_stream_free+0x38/0x70 net/sctp/stream.c:209
PGD 1fff84067 P4D 1fff84067 PUD 1fc97b067 PMD 0
Oops: 0000 [#1] SMP
Dumping ftrace buffer:
    (ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 17287 Comm: syz-executor2 Not tainted 4.15.0-rc3-next-20171214+  
#67
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:sctp_stream_free+0x38/0x70 net/sctp/stream.c:209
RSP: 0018:ffffc90000f87a28 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff82407e51
RDX: 000000000000b1ed RSI: ffffc90001031000 RDI: ffff88020f8126d8
RBP: ffffc90000f87a40 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88020f8126d8 R14: ffff8802157464b0 R15: ffff8801fa982000
FS:  00007fe140a3f700(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020616ff8 CR3: 0000000200d69003 CR4: 00000000001606f0
DR0: 0000000020000000 DR1: 0000000020000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
  sctp_association_free+0xd8/0x270 net/sctp/associola.c:367
  sctp_sf_do_unexpected_init.isra.30+0x25e/0x530 net/sctp/sm_statefuns.c:1589
  sctp_sf_do_5_2_2_dupinit+0x35/0x40 net/sctp/sm_statefuns.c:1646
  sctp_do_sm+0x80/0x1dc0 net/sctp/sm_sideeffect.c:1190
  sctp_endpoint_bh_rcv+0x142/0x2a0 net/sctp/endpointola.c:456
  sctp_inq_push+0x6a/0xb0 net/sctp/inqueue.c:95
  sctp_backlog_rcv+0x61/0x3a0 net/sctp/input.c:350
  sk_backlog_rcv include/net/sock.h:907 [inline]
  __release_sock+0x85/0x160 net/core/sock.c:2264
  release_sock+0x37/0xe0 net/core/sock.c:2779
  sctp_connect+0x6c/0x80 net/sctp/socket.c:4333
  inet_dgram_connect+0x78/0xb0 net/ipv4/af_inet.c:541
  SYSC_connect+0xaf/0x130 net/socket.c:1619
  SyS_connect+0x24/0x30 net/socket.c:1600
  entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452a09
RSP: 002b:00007fe140a3ec58 EFLAGS: 00000212 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000452a09
RDX: 0000000000000010 RSI: 00000000200ba000 RDI: 0000000000000013
RBP: 000000000000004e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006ed7f0
R13: 0000000000000014 R14: 000000000071bf00 R15: ffffffffffffffff
Code: 0f 25 eb fe 4c 89 ef e8 c7 3c 00 00 4c 89 ef ff 50 20 66 41 83 7d 10  
00 74 28 45 31 e4 31 db e8 ef 24 eb fe 49 8b 45 00 83 c3 01 <4a> 8b 7c 20  
08 49 83 c4 18 e8 ea 5d fd fe 41 0f b7 45 10 39 d8
RIP: sctp_stream_free+0x38/0x70 net/sctp/stream.c:209 RSP: ffffc90000f87a28
CR2: 0000000000000008
---[ end trace 5fbb25ea4389478d ]---

---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to [email-masked].
Please credit me with: Reported-by: syzbot <[email-masked]>

syzbot will keep track of this bug report.
Once a fix for this bug is merged into any tree, reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.