Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
memory leak in hub_event
BUG: memory leak
unreferenced object 0xffff88810e77d800 (size 2048):
comm "kworker/1:5", pid 10456, jiffies 4294945576 (age 16.470s)
hex dump (first 32 bytes):
ff ff ff ff 31 00 00 00 00 00 00 00 00 00 00 00 ....1...........
00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 ................
backtrace:
[<ffffffff82b8f5c2>] kmalloc include/linux/slab.h:554 [inline]
[<ffffffff82b8f5c2>] kzalloc include/linux/slab.h:684 [inline]
[<ffffffff82b8f5c2>] usb_alloc_dev+0x32/0x450 drivers/usb/core/usb.c:582
[<ffffffff82b991e1>] hub_port_connect drivers/usb/core/hub.c:5129 [inline]
[<ffffffff82b991e1>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b991e1>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b991e1>] hub_event+0x1171/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] 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 0xffff88812498b160 (size 32):
comm "kworker/1:5", pid 10456, jiffies 4294945576 (age 16.470s)
hex dump (first 32 bytes):
31 2d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 1-1.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff822330ec>] kvasprintf+0x6c/0xf0 lib/kasprintf.c:25
[<ffffffff822331c8>] kvasprintf_const+0x58/0x110 lib/kasprintf.c:49
[<ffffffff822f2ffb>] kobject_set_name_vargs+0x3b/0xe0 lib/kobject.c:289
[<ffffffff825eb323>] dev_set_name+0x63/0x90 drivers/base/core.c:3028
[<ffffffff82b8f77e>] usb_alloc_dev+0x1ee/0x450 drivers/usb/core/usb.c:650
[<ffffffff82b991e1>] hub_port_connect drivers/usb/core/hub.c:5129 [inline]
[<ffffffff82b991e1>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b991e1>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b991e1>] hub_event+0x1171/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] 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 0xffff888124e52c00 (size 1024):
comm "kworker/1:5", pid 10456, jiffies 4294945623 (age 16.000s)
hex dump (first 32 bytes):
09 02 48 00 01 00 00 00 00 00 00 00 00 00 00 00 ..H.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff82ba82bc>] kmalloc include/linux/slab.h:559 [inline]
[<ffffffff82ba82bc>] kzalloc include/linux/slab.h:684 [inline]
[<ffffffff82ba82bc>] usb_get_configuration+0x9c/0x1dd0 drivers/usb/core/config.c:882
[<ffffffff82b96a29>] usb_enumerate_device drivers/usb/core/hub.c:2388 [inline]
[<ffffffff82b96a29>] usb_new_device+0x1a9/0x2e0 drivers/usb/core/hub.c:2524
[<ffffffff82b9949e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
[<ffffffff82b9949e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b9949e>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b9949e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] 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 0xffff888124e9ada0 (size 32):
comm "kworker/1:5", pid 10456, jiffies 4294945623 (age 16.000s)
hex dump (first 32 bytes):
00 20 ef 24 81 88 ff ff 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:
[<ffffffff82ba82ee>] kmalloc include/linux/slab.h:559 [inline]
[<ffffffff82ba82ee>] kzalloc include/linux/slab.h:684 [inline]
[<ffffffff82ba82ee>] usb_get_configuration+0xce/0x1dd0 drivers/usb/core/config.c:887
[<ffffffff82b96a29>] usb_enumerate_device drivers/usb/core/hub.c:2388 [inline]
[<ffffffff82b96a29>] usb_new_device+0x1a9/0x2e0 drivers/usb/core/hub.c:2524
[<ffffffff82b9949e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
[<ffffffff82b9949e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b9949e>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b9949e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] 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 0xffff888124f99780 (size 128):
comm "kworker/1:5", pid 10456, jiffies 4294945639 (age 15.840s)
hex dump (first 32 bytes):
03 00 00 00 01 00 00 00 09 04 7d 00 03 1d 5a bf ..........}...Z.
00 00 00 00 00 00 00 00 12 20 ef 24 81 88 ff ff ......... .$....
backtrace:
[<ffffffff82ba8a05>] kmalloc include/linux/slab.h:559 [inline]
[<ffffffff82ba8a05>] kzalloc include/linux/slab.h:684 [inline]
[<ffffffff82ba8a05>] usb_parse_configuration drivers/usb/core/config.c:772 [inline]
[<ffffffff82ba8a05>] usb_get_configuration+0x7e5/0x1dd0 drivers/usb/core/config.c:944
[<ffffffff82b96a29>] usb_enumerate_device drivers/usb/core/hub.c:2388 [inline]
[<ffffffff82b96a29>] usb_new_device+0x1a9/0x2e0 drivers/usb/core/hub.c:2524
[<ffffffff82b9949e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
[<ffffffff82b9949e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b9949e>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b9949e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] 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 0xffff888124e49c00 (size 256):
comm "kworker/1:5", pid 10456, jiffies 4294945639 (age 15.840s)
hex dump (first 32 bytes):
09 05 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 18 9c e4 24 81 88 ff ff ...........$....
backtrace:
[<ffffffff82ba8d9f>] kmalloc include/linux/slab.h:559 [inline]
[<ffffffff82ba8d9f>] kzalloc include/linux/slab.h:684 [inline]
[<ffffffff82ba8d9f>] usb_parse_interface drivers/usb/core/config.c:571 [inline]
[<ffffffff82ba8d9f>] usb_parse_configuration drivers/usb/core/config.c:795 [inline]
[<ffffffff82ba8d9f>] usb_get_configuration+0xb7f/0x1dd0 drivers/usb/core/config.c:944
[<ffffffff82b96a29>] usb_enumerate_device drivers/usb/core/hub.c:2388 [inline]
[<ffffffff82b96a29>] usb_new_device+0x1a9/0x2e0 drivers/usb/core/hub.c:2524
[<ffffffff82b9949e>] hub_port_connect drivers/usb/core/hub.c:5223 [inline]
[<ffffffff82b9949e>] hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
[<ffffffff82b9949e>] port_event drivers/usb/core/hub.c:5509 [inline]
[<ffffffff82b9949e>] hub_event+0x142e/0x20c0 drivers/usb/core/hub.c:5591
[<ffffffff81259839>] process_one_work+0x2c9/0x600 kernel/workqueue.c:2275
[<ffffffff8125a129>] worker_thread+0x59/0x5d0 kernel/workqueue.c:2421
[<ffffffff81261858>] kthread+0x178/0x1b0 kernel/kthread.c:292
[<ffffffff8100227f>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
Tested on:
commit: 00232240 Merge branch 'akpm' (patches from Andrew)
git tree: upstream
console output:
https://syzkaller.appspot.com/x/log.txt?x=16727f3ad00000