Subject: [syzbot] [nfc?] memory leak in virtual_ncidev_write (2)

From: syzbot <[email-masked]>
Date: Tue, 11 Jul 2023 22:54:56 -0700

Hello,

syzbot found the following issue on:

HEAD commit:    4f6b6c2b2f86 Merge tag 'riscv-for-linus-6.5-mw2' of git://..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1565b4e2a80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=832b404e095b70c0
dashboard link: https://syzkaller.appspot.com/bug?extid=6b7c68d9c21e4ee4251b
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=1296aa88a80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13e31cbca80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/894096f65e3a/disk-4f6b6c2b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/fb7cd620415e/vmlinux-4f6b6c2b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5b6554eae0e7/bzImage-4f6b6c2b.xz

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

executing program
BUG: memory leak
unreferenced object 0xffff88810ac1a700 (size 240):
  comm "syz-executor366", pid 5017, jiffies 4294944625 (age 12.970s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff83e1b1cd>] __alloc_skb+0x1fd/0x230 net/core/skbuff.c:634
    [<ffffffff82c344e4>] alloc_skb include/linux/skbuff.h:1289 [inline]
    [<ffffffff82c344e4>] virtual_ncidev_write+0x34/0xf0 drivers/nfc/virtual_ncidev.c:115
    [<ffffffff8165e315>] vfs_write+0x175/0x570 fs/read_write.c:582
    [<ffffffff8165e951>] ksys_write+0xa1/0x160 fs/read_write.c:637
    [<ffffffff84a76ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a76ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff888109c4b400 (size 640):
  comm "syz-executor366", pid 5017, jiffies 4294944625 (age 12.970s)
  hex dump (first 32 bytes):
    10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff83e17a86>] kmalloc_reserve+0xe6/0x180 net/core/skbuff.c:559
    [<ffffffff83e1b0a5>] __alloc_skb+0xd5/0x230 net/core/skbuff.c:644
    [<ffffffff82c344e4>] alloc_skb include/linux/skbuff.h:1289 [inline]
    [<ffffffff82c344e4>] virtual_ncidev_write+0x34/0xf0 drivers/nfc/virtual_ncidev.c:115
    [<ffffffff8165e315>] vfs_write+0x175/0x570 fs/read_write.c:582
    [<ffffffff8165e951>] ksys_write+0xa1/0x160 fs/read_write.c:637
    [<ffffffff84a76ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a76ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

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

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup