syzbot


memory leak in class_create

Status: fixed on 2023/07/01 16:05
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+e7afd76ad060fa0d2605@syzkaller.appspotmail.com
Fix commit: ddaf098ea779 driver core: class: properly reference count class_dev_iter()
First crash: 351d, last: 331d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] driver core: class: properly reference count class_dev_iter() 3 (3) 2023/05/18 19:42
[syzbot] [usb?] memory leak in class_create 2 (5) 2023/05/16 14:27
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/05/16 13:54 25m gregkh@linuxfoundation.org patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 22b8cc3e78f5 OK log
2023/05/01 19:16 19m stern@rowland.harvard.edu patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 22b8cc3e78f5 report log

Sample crash report:
BUG: memory leak
unreferenced object 0xffff88810855bc80 (size 96):
  comm "kworker/0:1", pid 8, jiffies 4294948216 (age 13.910s)
  hex dump (first 32 bytes):
    95 36 9b 85 ff ff ff ff 00 00 00 00 00 00 00 00  .6..............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff81545984>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1057
    [<ffffffff82b68835>] kmalloc include/linux/slab.h:559 [inline]
    [<ffffffff82b68835>] kzalloc include/linux/slab.h:680 [inline]
    [<ffffffff82b68835>] class_create+0x25/0x90 drivers/base/class.c:261
    [<ffffffff831fb3b0>] init_usb_class drivers/usb/core/file.c:91 [inline]
    [<ffffffff831fb3b0>] usb_register_dev+0x290/0x3d0 drivers/usb/core/file.c:179
    [<ffffffff832dc2b5>] usbtmc_probe+0x495/0x6f0 drivers/usb/class/usbtmc.c:2459
    [<ffffffff831f72d9>] usb_probe_interface+0x179/0x3c0 drivers/usb/core/driver.c:396
    [<ffffffff82b6616d>] call_driver_probe drivers/base/dd.c:579 [inline]
    [<ffffffff82b6616d>] really_probe+0x12d/0x430 drivers/base/dd.c:658
    [<ffffffff82b66531>] __driver_probe_device+0xc1/0x1a0 drivers/base/dd.c:800
    [<ffffffff82b6663a>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:830
    [<ffffffff82b6682b>] __device_attach_driver+0xfb/0x150 drivers/base/dd.c:958
    [<ffffffff82b63581>] bus_for_each_drv+0xc1/0x110 drivers/base/bus.c:457
    [<ffffffff82b66d52>] __device_attach+0x102/0x2a0 drivers/base/dd.c:1030
    [<ffffffff82b64cea>] bus_probe_device+0xca/0xd0 drivers/base/bus.c:532
    [<ffffffff82b612e3>] device_add+0x993/0xc60 drivers/base/core.c:3625
    [<ffffffff831f43b9>] usb_set_configuration+0x9a9/0xc90 drivers/usb/core/message.c:2211
    [<ffffffff83206ce1>] usb_generic_driver_probe+0xa1/0x100 drivers/usb/core/generic.c:238
    [<ffffffff831f69b0>] usb_probe_device+0x60/0x140 drivers/usb/core/driver.c:293

BUG: memory leak
unreferenced object 0xffff88810b452a00 (size 512):
  comm "kworker/0:1", pid 8, jiffies 4294948216 (age 13.910s)
  hex dump (first 32 bytes):
    00 2a 45 0b 81 88 ff ff 00 2a 45 0b 81 88 ff ff  .*E......*E.....
    00 00 00 00 00 00 00 00 95 36 9b 85 ff ff ff ff  .........6......
  backtrace:
    [<ffffffff81545984>] kmalloc_trace+0x24/0x90 mm/slab_common.c:1057
    [<ffffffff82b686f8>] kmalloc include/linux/slab.h:559 [inline]
    [<ffffffff82b686f8>] kzalloc include/linux/slab.h:680 [inline]
    [<ffffffff82b686f8>] class_register+0x28/0x140 drivers/base/class.c:186
    [<ffffffff82b68857>] class_create+0x47/0x90 drivers/base/class.c:270
    [<ffffffff831fb3b0>] init_usb_class drivers/usb/core/file.c:91 [inline]
    [<ffffffff831fb3b0>] usb_register_dev+0x290/0x3d0 drivers/usb/core/file.c:179
    [<ffffffff832dc2b5>] usbtmc_probe+0x495/0x6f0 drivers/usb/class/usbtmc.c:2459
    [<ffffffff831f72d9>] usb_probe_interface+0x179/0x3c0 drivers/usb/core/driver.c:396
    [<ffffffff82b6616d>] call_driver_probe drivers/base/dd.c:579 [inline]
    [<ffffffff82b6616d>] really_probe+0x12d/0x430 drivers/base/dd.c:658
    [<ffffffff82b66531>] __driver_probe_device+0xc1/0x1a0 drivers/base/dd.c:800
    [<ffffffff82b6663a>] driver_probe_device+0x2a/0x120 drivers/base/dd.c:830
    [<ffffffff82b6682b>] __device_attach_driver+0xfb/0x150 drivers/base/dd.c:958
    [<ffffffff82b63581>] bus_for_each_drv+0xc1/0x110 drivers/base/bus.c:457
    [<ffffffff82b66d52>] __device_attach+0x102/0x2a0 drivers/base/dd.c:1030
    [<ffffffff82b64cea>] bus_probe_device+0xca/0xd0 drivers/base/bus.c:532
    [<ffffffff82b612e3>] device_add+0x993/0xc60 drivers/base/core.c:3625
    [<ffffffff831f43b9>] usb_set_configuration+0x9a9/0xc90 drivers/usb/core/message.c:2211
    [<ffffffff83206ce1>] usb_generic_driver_probe+0xa1/0x100 drivers/usb/core/generic.c:238


Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/19 09:17 upstream 2d1bcbc6cd70 3bb7af1d .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/19 08:06 upstream 2d1bcbc6cd70 3bb7af1d .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/13 12:17 upstream 9a48d6046722 2b9ba477 .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/06 04:00 upstream 78b421b6a7c6 4cec9341 .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/06 00:33 upstream 78b421b6a7c6 4cec9341 .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/04 02:58 upstream 89b7fd5d7f3c b5918830 .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/04/29 05:36 upstream 22b8cc3e78f5 62df2017 .config console log report syz C ci-upstream-gce-leak memory leak in class_create
2023/05/16 05:18 upstream f1fcbaa18b28 71b00cfb .config console log report syz ci-upstream-gce-leak memory leak in class_create
2023/05/01 12:57 upstream 58390c8ce1bd 62df2017 .config console log report syz ci-upstream-gce-leak memory leak in class_create
* Struck through repros no longer work on HEAD.