syzbot


memory leak in usb_set_configuration (2)

Status: fixed on 2021/11/10 00:50
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+d1e69c888f0d3866ead4@syzkaller.appspotmail.com
Fix commit: be8656e62e9e media: cpia2: fix memory leak in cpia2_usb_probe
First crash: 1076d, last: 964d
Discussions (19)
Title Replies (including bot) Last reply
[PATCH 5.13 000/800] 5.13.2-rc1 review 840 (840) 2021/07/28 17:46
[PATCH 4.4 000/188] 4.4.276-rc1 review 195 (195) 2021/07/21 10:42
[PATCH 4.9 000/245] 4.9.276-rc1 review 250 (250) 2021/07/21 10:29
[PATCH 4.14 000/315] 4.14.240-rc1 review 321 (321) 2021/07/20 08:21
[PATCH 4.19 000/421] 4.19.198-rc1 review 423 (423) 2021/07/19 16:00
[PATCH 5.10 000/593] 5.10.50-rc1 review 615 (615) 2021/07/16 05:18
[PATCH 5.12 000/700] 5.12.17-rc1 review 708 (708) 2021/07/13 21:37
[PATCH 5.4 000/348] 5.4.132-rc1 review 354 (354) 2021/07/12 18:54
[PATCH AUTOSEL 5.13 01/85] spi: Make of_register_spi_device also set the fwnode 89 (89) 2021/07/09 14:02
[PATCH AUTOSEL 5.12 01/80] spi: Make of_register_spi_device also set the fwnode 82 (82) 2021/07/05 10:12
[PATCH AUTOSEL 4.4 01/15] spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages() 15 (15) 2021/07/04 23:12
[PATCH AUTOSEL 4.9 01/20] spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf' 20 (20) 2021/07/04 23:11
[PATCH AUTOSEL 4.14 01/25] spi: Make of_register_spi_device also set the fwnode 25 (25) 2021/07/04 23:11
[PATCH AUTOSEL 4.19 01/31] spi: Make of_register_spi_device also set the fwnode 31 (31) 2021/07/04 23:10
[PATCH AUTOSEL 5.4 01/50] spi: Make of_register_spi_device also set the fwnode 50 (50) 2021/07/04 23:09
[PATCH AUTOSEL 5.10 01/70] spi: Make of_register_spi_device also set the fwnode 70 (70) 2021/07/04 23:08
[PATCH] cpia2: unregister device on probe error 1 (1) 2021/04/22 13:30
[syzbot] memory leak in usb_set_configuration (2) 2 (4) 2021/04/22 12:45
[PATCH] media: cpia2: fix memory leak in cpia2_usb_probe 1 (1) 2021/04/21 19:43
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream memory leak in usb_set_configuration (3) usb C 2 637d 663d 22/26 fixed on 2023/02/24 13:50
upstream memory leak in usb_set_configuration usb C 56 1148d 1233d 0/26 closed as dup on 2020/12/02 20:32
Last patch testing requests (2)
Created Duration User Patch Repo Result
2021/04/22 12:27 17m oneukum@suse.com patch https://github.com/google/kasan.git 9cdbf646 OK
2021/04/21 18:36 16m paskripkin@gmail.com https://linux.googlesource.com/linux/kernel/git/torvalds/linux refs/changes/16/10416/1 OK

Sample crash report:
BUG: memory leak
unreferenced object 0xffff8881120e1400 (size 1024):
  comm "kworker/0:2", pid 3660, jiffies 4294952380 (age 24.950s)
  hex dump (first 32 bytes):
    c8 78 3c 12 81 88 ff ff c8 78 3c 12 81 88 ff ff  .x<......x<.....
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff82ba5d37>] kmalloc include/linux/slab.h:554 [inline]
    [<ffffffff82ba5d37>] kzalloc include/linux/slab.h:684 [inline]
    [<ffffffff82ba5d37>] usb_set_configuration+0x187/0xb90 drivers/usb/core/message.c:1992
    [<ffffffff82bb69ec>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
    [<ffffffff82ba874c>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
    [<ffffffff825f67f9>] really_probe+0x159/0x4a0 drivers/base/dd.c:559
    [<ffffffff825f6bc4>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
    [<ffffffff825f72de>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:851
    [<ffffffff825f3747>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
    [<ffffffff825f6e72>] __device_attach+0x122/0x250 drivers/base/dd.c:919
    [<ffffffff825f53e6>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
    [<ffffffff825f1935>] device_add+0x5d5/0xc40 drivers/base/core.c:3242
    [<ffffffff841df2d9>] usb_new_device.cold+0x16a/0x582 drivers/usb/core/hub.c:2555
    [<ffffffff82b9b24e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
    [<ffffffff82b9b24e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
    [<ffffffff82b9b24e>] port_event drivers/usb/core/hub.c:5509 [inline]
    [<ffffffff82b9b24e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
    [<ffffffff81259619>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
    [<ffffffff81259f09>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
    [<ffffffff81261638>] kthread+0x178/0x1b0 kernel/kthread.c:292
    [<ffffffff8100227f>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

BUG: memory leak
unreferenced object 0xffff888110a217a0 (size 32):
  comm "kworker/0:2", pid 3660, jiffies 4294952380 (age 24.950s)
  hex dump (first 32 bytes):
    31 2d 31 3a 30 2e 32 34 31 00 00 00 00 00 00 00  1-1:0.241.......
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff8223411c>] kvasprintf+0x6c/0xf0 lib/kasprintf.c:25
    [<ffffffff822341f8>] kvasprintf_const+0x58/0x110 lib/kasprintf.c:49
    [<ffffffff822f402b>] kobject_set_name_vargs+0x3b/0xe0 lib/kobject.c:289
    [<ffffffff825ec413>] dev_set_name+0x63/0x90 drivers/base/core.c:3028
    [<ffffffff82ba6269>] usb_set_configuration+0x6b9/0xb90 drivers/usb/core/message.c:2099
    [<ffffffff82bb69ec>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
    [<ffffffff82ba874c>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
    [<ffffffff825f67f9>] really_probe+0x159/0x4a0 drivers/base/dd.c:559
    [<ffffffff825f6bc4>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
    [<ffffffff825f72de>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:851
    [<ffffffff825f3747>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
    [<ffffffff825f6e72>] __device_attach+0x122/0x250 drivers/base/dd.c:919
    [<ffffffff825f53e6>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
    [<ffffffff825f1935>] device_add+0x5d5/0xc40 drivers/base/core.c:3242
    [<ffffffff841df2d9>] usb_new_device.cold+0x16a/0x582 drivers/usb/core/hub.c:2555
    [<ffffffff82b9b24e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
    [<ffffffff82b9b24e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
    [<ffffffff82b9b24e>] port_event drivers/usb/core/hub.c:5509 [inline]
    [<ffffffff82b9b24e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591

BUG: memory leak
unreferenced object 0xffff88810c472800 (size 256):
  comm "kworker/0:2", pid 3660, jiffies 4294952409 (age 24.660s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 08 28 47 0c 81 88 ff ff  .........(G.....
    08 28 47 0c 81 88 ff ff b0 c4 5e 82 ff ff ff ff  .(G.......^.....
  backtrace:
    [<ffffffff825f1b71>] kmalloc include/linux/slab.h:554 [inline]
    [<ffffffff825f1b71>] kzalloc include/linux/slab.h:684 [inline]
    [<ffffffff825f1b71>] device_private_init drivers/base/core.c:3084 [inline]
    [<ffffffff825f1b71>] device_add+0x811/0xc40 drivers/base/core.c:3134
    [<ffffffff82ba6589>] usb_set_configuration+0x9d9/0xb90 drivers/usb/core/message.c:2164
    [<ffffffff82bb69ec>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
    [<ffffffff82ba874c>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
    [<ffffffff825f67f9>] really_probe+0x159/0x4a0 drivers/base/dd.c:559
    [<ffffffff825f6bc4>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
    [<ffffffff825f72de>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:851
    [<ffffffff825f3747>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
    [<ffffffff825f6e72>] __device_attach+0x122/0x250 drivers/base/dd.c:919
    [<ffffffff825f53e6>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
    [<ffffffff825f1935>] device_add+0x5d5/0xc40 drivers/base/core.c:3242
    [<ffffffff841df2d9>] usb_new_device.cold+0x16a/0x582 drivers/usb/core/hub.c:2555
    [<ffffffff82b9b24e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
    [<ffffffff82b9b24e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
    [<ffffffff82b9b24e>] port_event drivers/usb/core/hub.c:5509 [inline]
    [<ffffffff82b9b24e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
    [<ffffffff81259619>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
    [<ffffffff81259f09>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
    [<ffffffff81261638>] kthread+0x178/0x1b0 kernel/kthread.c:292

[  176.

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/17 15:07 upstream 9cdbf6467424 7e2b734b .config console log report syz C ci-upstream-gce-leak memory leak in usb_set_configuration
2021/08/07 21:19 upstream c9194f32bfd9 6972b106 .config console log report syz ci-upstream-gce-leak memory leak in usb_set_configuration
* Struck through repros no longer work on HEAD.