syzbot


memory leak in raw_open

Status: fixed on 2023/10/12 12:48
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+feb045d335c1fdde5bf7@syzkaller.appspotmail.com
Fix commit: 83e30f2bf86e USB: gadget: Fix the memory leak in raw_gadget driver
First crash: 490d, last: 490d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] USB: gadget: Fix the memory leak in raw_gadget driver 5 (5) 2023/07/21 06:03
[syzbot] [usb?] memory leak in raw_open 5 (9) 2023/07/14 10:01
Last patch testing requests (3)
Created Duration User Patch Repo Result
2023/07/14 06:35 2h44m qiang.zhang1211@gmail.com patch linux-next error
2023/07/14 07:12 2h26m qiang.zhang1211@gmail.com patch linux-next error
2023/07/14 06:21 0m qiang.zhang1211@gmail.com patch linux-next error

Sample crash report:
BUG: memory leak
unreferenced object 0xffff88810b172000 (size 4096):
  comm "syz-executor103", pid 5067, jiffies 4294964128 (age 13.070s)
  hex dump (first 32 bytes):
    01 00 00 00 00 00 00 00 00 bc 96 0e 81 88 ff ff  ................
    5d b6 9e 85 ff ff ff ff 03 00 00 00 00 00 00 00  ]...............
  backtrace:
    [<ffffffff8154bf94>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1076
    [<ffffffff8347eb55>] kmalloc include/linux/slab.h:582 [inline]
    [<ffffffff8347eb55>] kzalloc include/linux/slab.h:703 [inline]
    [<ffffffff8347eb55>] dev_new drivers/usb/gadget/legacy/raw_gadget.c:191 [inline]
    [<ffffffff8347eb55>] raw_open+0x45/0x110 drivers/usb/gadget/legacy/raw_gadget.c:385
    [<ffffffff827d1d09>] misc_open+0x1a9/0x1f0 drivers/char/misc.c:165
    [<ffffffff8166763b>] chrdev_open+0x11b/0x340 fs/char_dev.c:414
    [<ffffffff8165573f>] do_dentry_open+0x30f/0x990 fs/open.c:914
    [<ffffffff8167cabb>] do_open fs/namei.c:3636 [inline]
    [<ffffffff8167cabb>] path_openat+0x178b/0x1b20 fs/namei.c:3793
    [<ffffffff8167e995>] do_filp_open+0xc5/0x1b0 fs/namei.c:3820
    [<ffffffff81659453>] do_sys_openat2+0xe3/0x140 fs/open.c:1407
    [<ffffffff81659de3>] do_sys_open fs/open.c:1422 [inline]
    [<ffffffff81659de3>] __do_sys_openat fs/open.c:1438 [inline]
    [<ffffffff81659de3>] __se_sys_openat fs/open.c:1433 [inline]
    [<ffffffff81659de3>] __x64_sys_openat+0x83/0xe0 fs/open.c:1433
    [<ffffffff84a77ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a77ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810ad20d60 (size 32):
  comm "syz-executor103", pid 5067, jiffies 4294964128 (age 13.070s)
  hex dump (first 32 bytes):
    72 61 77 2d 67 61 64 67 65 74 2e 30 00 00 00 00  raw-gadget.0....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff8154bf94>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1076
    [<ffffffff8347cd2f>] kmalloc include/linux/slab.h:582 [inline]
    [<ffffffff8347cd2f>] raw_ioctl_init+0xdf/0x410 drivers/usb/gadget/legacy/raw_gadget.c:460
    [<ffffffff8347dfe9>] raw_ioctl+0x5f9/0x1120 drivers/usb/gadget/legacy/raw_gadget.c:1250
    [<ffffffff81685173>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff81685173>] __do_sys_ioctl fs/ioctl.c:870 [inline]
    [<ffffffff81685173>] __se_sys_ioctl fs/ioctl.c:856 [inline]
    [<ffffffff81685173>] __x64_sys_ioctl+0x103/0x140 fs/ioctl.c:856
    [<ffffffff84a77ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a77ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810e96bc00 (size 128):
  comm "syz-executor103", pid 5067, jiffies 4294964128 (age 13.070s)
  hex dump (first 32 bytes):
    64 75 6d 6d 79 5f 75 64 63 00 00 00 00 00 00 00  dummy_udc.......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff8154bf94>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1076
    [<ffffffff8347cd6d>] kmalloc include/linux/slab.h:582 [inline]
    [<ffffffff8347cd6d>] raw_ioctl_init+0x11d/0x410 drivers/usb/gadget/legacy/raw_gadget.c:468
    [<ffffffff8347dfe9>] raw_ioctl+0x5f9/0x1120 drivers/usb/gadget/legacy/raw_gadget.c:1250
    [<ffffffff81685173>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff81685173>] __do_sys_ioctl fs/ioctl.c:870 [inline]
    [<ffffffff81685173>] __se_sys_ioctl fs/ioctl.c:856 [inline]
    [<ffffffff81685173>] __x64_sys_ioctl+0x103/0x140 fs/ioctl.c:856
    [<ffffffff84a77ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a77ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810e96ba80 (size 128):
  comm "syz-executor103", pid 5067, jiffies 4294964128 (age 13.070s)
  hex dump (first 32 bytes):
    64 75 6d 6d 79 5f 75 64 63 2e 30 00 00 00 00 00  dummy_udc.0.....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff8154bf94>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1076
    [<ffffffff8347cdfc>] kmalloc include/linux/slab.h:582 [inline]
    [<ffffffff8347cdfc>] raw_ioctl_init+0x1ac/0x410 drivers/usb/gadget/legacy/raw_gadget.c:479
    [<ffffffff8347dfe9>] raw_ioctl+0x5f9/0x1120 drivers/usb/gadget/legacy/raw_gadget.c:1250
    [<ffffffff81685173>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff81685173>] __do_sys_ioctl fs/ioctl.c:870 [inline]
    [<ffffffff81685173>] __se_sys_ioctl fs/ioctl.c:856 [inline]
    [<ffffffff81685173>] __x64_sys_ioctl+0x103/0x140 fs/ioctl.c:856
    [<ffffffff84a77ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a77ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

BUG: memory leak
unreferenced object 0xffff88810e96bd00 (size 128):
  comm "syz-executor103", pid 5067, jiffies 4294964128 (age 13.070s)
  hex dump (first 32 bytes):
    00 bd 96 0e 81 88 ff ff 00 bd 96 0e 81 88 ff ff  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff8154bf94>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1076
    [<ffffffff833ecc6a>] kmalloc include/linux/slab.h:582 [inline]
    [<ffffffff833ecc6a>] kzalloc include/linux/slab.h:703 [inline]
    [<ffffffff833ecc6a>] dummy_alloc_request+0x5a/0xe0 drivers/usb/gadget/udc/dummy_hcd.c:665
    [<ffffffff833e9132>] usb_ep_alloc_request+0x22/0xd0 drivers/usb/gadget/udc/core.c:196
    [<ffffffff8347f13d>] gadget_bind+0x6d/0x370 drivers/usb/gadget/legacy/raw_gadget.c:292
    [<ffffffff833e9e83>] gadget_bind_driver+0xe3/0x2e0 drivers/usb/gadget/udc/core.c:1591
    [<ffffffff82ba069d>] call_driver_probe drivers/base/dd.c:579 [inline]
    [<ffffffff82ba069d>] really_probe+0x12d/0x430 drivers/base/dd.c:658
    [<ffffffff82ba0a61>] __driver_probe_device+0xc1/0x1a0 drivers/base/dd.c:798
    [<ffffffff82ba0b6a>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:828
    [<ffffffff82ba0eae>] __driver_attach drivers/base/dd.c:1214 [inline]
    [<ffffffff82ba0eae>] __driver_attach+0xfe/0x1f0 drivers/base/dd.c:1154
    [<ffffffff82b9d985>] bus_for_each_dev+0xa5/0x110 drivers/base/bus.c:368
    [<ffffffff82b9f486>] bus_add_driver+0x126/0x2a0 drivers/base/bus.c:673
    [<ffffffff82ba25da>] driver_register+0x8a/0x190 drivers/base/driver.c:246
    [<ffffffff833e7524>] usb_gadget_register_driver_owner+0x64/0x160 drivers/usb/gadget/udc/core.c:1665
    [<ffffffff8347e0e6>] raw_ioctl_run drivers/usb/gadget/legacy/raw_gadget.c:546 [inline]
    [<ffffffff8347e0e6>] raw_ioctl+0x6f6/0x1120 drivers/usb/gadget/legacy/raw_gadget.c:1253
    [<ffffffff81685173>] vfs_ioctl fs/ioctl.c:51 [inline]
    [<ffffffff81685173>] __do_sys_ioctl fs/ioctl.c:870 [inline]
    [<ffffffff81685173>] __se_sys_ioctl fs/ioctl.c:856 [inline]
    [<ffffffff81685173>] __x64_sys_ioctl+0x103/0x140 fs/ioctl.c:856
    [<ffffffff84a77ff9>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    [<ffffffff84a77ff9>] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80


Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/09 09:49 upstream 1c7873e33645 668cb1fa .config console log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-gce-leak memory leak in raw_open
* Struck through repros no longer work on HEAD.