Subject: [syzbot] memory leak in sctp_sched_prio_set

From: syzbot <[email-masked]>
Date: Thu, 17 Nov 2022 21:18:43 -0800

Hello,

syzbot found the following issue on:

HEAD commit:    b2d229d4ddb1 Linux 5.18-rc3
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17e439b8f00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=2197cd22d3971cc5
dashboard link: https://syzkaller.appspot.com/bug?extid=29c402e56c4760763cc0
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17daf0af700000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10ae4d5cf00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email-masked]

executing program
executing program
BUG: memory leak
unreferenced object 0xffff88810b472a00 (size 64):
  comm "syz-executor206", pid 3601, jiffies 4294944661 (age 12.290s)
  hex dump (first 32 bytes):
    00 2a 47 0b 81 88 ff ff 00 2a 47 0b 81 88 ff ff  .*G......*G.....
    10 2a 47 0b 81 88 ff ff 10 2a 47 0b 81 88 ff ff  .*G......*G.....
  backtrace:
    [<ffffffff83fa1634>] kmalloc include/linux/slab.h:581 [inline]
    [<ffffffff83fa1634>] sctp_sched_prio_new_head net/sctp/stream_sched_prio.c:33 [inline]
    [<ffffffff83fa1634>] sctp_sched_prio_get_head net/sctp/stream_sched_prio.c:77 [inline]
    [<ffffffff83fa1634>] sctp_sched_prio_set+0x2c4/0x370 net/sctp/stream_sched_prio.c:159
    [<ffffffff83f9b6a6>] sctp_stream_init_ext+0x86/0xf0 net/sctp/stream.c:176
    [<ffffffff83f86e0e>] sctp_sendmsg_to_asoc+0xc8e/0xdb0 net/sctp/socket.c:1807
    [<ffffffff83f8f77f>] sctp_sendmsg+0x99f/0x1030 net/sctp/socket.c:2027
    [<ffffffff83b7a315>] inet_sendmsg+0x45/0x70 net/ipv4/af_inet.c:819
    [<ffffffff837cb3e6>] sock_sendmsg_nosec net/socket.c:705 [inline]
    [<ffffffff837cb3e6>] sock_sendmsg+0x56/0x80 net/socket.c:725
    [<ffffffff837ce38c>] __sys_sendto+0x15c/0x200 net/socket.c:2040
    [<ffffffff837ce456>] __do_sys_sendto net/socket.c:2052 [inline]
    [<ffffffff837ce456>] __se_sys_sendto net/socket.c:2048 [inline]
    [<ffffffff837ce456>] __x64_sys_sendto+0x26/0x30 net/socket.c:2048
    [<ffffffff8451da45>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff8451da45>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email-masked].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches