Subject: [syzbot] memory leak in __vsock_create

From: syzbot <[email-masked]>
Date: Sat, 09 Apr 2022 22:46:18 -0700

Hello,

syzbot found the following issue on:

HEAD commit:    ce4c854ee868 Merge tag 'for-5.18-rc1-tag' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1099787f700000
kernel config:  https://syzkaller.appspot.com/x/.config?x=983cf973af0d1b0f
dashboard link: https://syzkaller.appspot.com/bug?extid=b03f55bf128f9a38f064
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=12bf17f7700000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12810bbf700000

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

Warning: Permanently added '10.128.1.36' (ECDSA) to the list of known hosts.
executing program
executing program
BUG: memory leak
unreferenced object 0xffff88810ea56a40 (size 1232):
  comm "syz-executor756", pid 3604, jiffies 4294947681 (age 12.350s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    28 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00  (..@............
  backtrace:
    [<ffffffff837c830e>] sk_prot_alloc+0x3e/0x1b0 net/core/sock.c:1930
    [<ffffffff837cbe22>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
    [<ffffffff842ccf68>] __vsock_create.constprop.0+0x38/0x320 net/vmw_vsock/af_vsock.c:734
    [<ffffffff842ce8f1>] vsock_create+0xc1/0x2d0 net/vmw_vsock/af_vsock.c:2203
    [<ffffffff837c0cbb>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
    [<ffffffff837c3acf>] sock_create net/socket.c:1519 [inline]
    [<ffffffff837c3acf>] __sys_socket+0x6f/0x140 net/socket.c:1561
    [<ffffffff837c3bba>] __do_sys_socket net/socket.c:1570 [inline]
    [<ffffffff837c3bba>] __se_sys_socket net/socket.c:1568 [inline]
    [<ffffffff837c3bba>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
    [<ffffffff84512815>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84512815>] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
    [<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae

BUG: memory leak
unreferenced object 0xffff88810fb89080 (size 96):
  comm "syz-executor756", pid 3604, jiffies 4294947681 (age 12.350s)
  hex dump (first 32 bytes):
    40 6a a5 0e 81 88 ff ff 00 00 00 00 00 00 00 00  @j..............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff842d3767>] kmalloc include/linux/slab.h:581 [inline]
    [<ffffffff842d3767>] kzalloc include/linux/slab.h:714 [inline]
    [<ffffffff842d3767>] virtio_transport_do_socket_init+0x27/0xe0 net/vmw_vsock/virtio_transport_common.c:593
    [<ffffffff842cbaf0>] vsock_assign_transport+0x200/0x320 net/vmw_vsock/af_vsock.c:502
    [<ffffffff842cf8a8>] vsock_connect+0x128/0x5d0 net/vmw_vsock/af_vsock.c:1345
    [<ffffffff837c4722>] __sys_connect_file+0x92/0xa0 net/socket.c:1900
    [<ffffffff81667a4a>] io_connect+0x8a/0x370 fs/io_uring.c:5711
    [<ffffffff8166ea49>] io_issue_sqe+0xb29/0x2cb0 fs/io_uring.c:7294
    [<ffffffff81671c09>] __io_queue_sqe fs/io_uring.c:7605 [inline]
    [<ffffffff81671c09>] io_queue_sqe fs/io_uring.c:7647 [inline]
    [<ffffffff81671c09>] io_submit_sqe fs/io_uring.c:7855 [inline]
    [<ffffffff81671c09>] io_submit_sqes+0xa99/0x2ed0 fs/io_uring.c:7961
    [<ffffffff81674581>] __do_sys_io_uring_enter+0x541/0xa20 fs/io_uring.c:11011
    [<ffffffff84512815>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84512815>] do_syscall_64+0x35/0x80 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