syzbot


KASAN: use-after-free Read in ax88172a_unbind

Status: fixed on 2021/10/13 19:27
Reported-by: syzbot+4f918b67a92902adfad4@syzkaller.appspotmail.com
Fix commit: d0d394c71604 ax88172a: fix ax88172a_unbind() failures
First crash: 1533d, last: 1418d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ax88172a_unbind usb C done 2723 1418d 1659d 15/27 fixed on 2020/09/16 22:51

Sample crash report:
asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88172A USB 2.0 Ethernet, 56:e5:76:48:89:61
usb 1-1: USB disconnect, device number 2
asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88172A USB 2.0 Ethernet
==================================================================
BUG: KASAN: use-after-free in ax88172a_remove_mdio drivers/net/usb/ax88172a.c:123 [inline]
BUG: KASAN: use-after-free in ax88172a_unbind+0x6a/0xc0 drivers/net/usb/ax88172a.c:274
Read of size 8 at addr ffff8881ce38a500 by task kworker/0:1/12

CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.4.47-syzkaller-00290-g5eb96e454e88 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x34/0x60 mm/kasan/common.c:634
 ax88172a_remove_mdio drivers/net/usb/ax88172a.c:123 [inline]
 ax88172a_unbind+0x6a/0xc0 drivers/net/usb/ax88172a.c:274
 usbnet_disconnect+0x14e/0x340 drivers/net/usb/usbnet.c:1618
 usb_unbind_interface+0x1d8/0x850 drivers/usb/core/driver.c:423
 __device_release_driver drivers/base/dd.c:1142 [inline]
 device_release_driver_internal+0x515/0x7b0 drivers/base/dd.c:1173
 bus_remove_device+0x2e7/0x350 drivers/base/bus.c:532
 device_del+0x7bc/0x1200 drivers/base/core.c:2821
 usb_disable_device+0x3fe/0xc90 drivers/usb/core/message.c:1244
 usb_disconnect+0x341/0x880 drivers/usb/core/hub.c:2217
 hub_port_connect drivers/usb/core/hub.c:4974 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
 port_event drivers/usb/core/hub.c:5384 [inline]
 hub_event+0x1c6c/0x4fa0 drivers/usb/core/hub.c:5466
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 12:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
 kmem_cache_alloc_trace+0xc3/0x280 mm/slub.c:2793
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 ax88172a_bind+0xc7/0x980 drivers/net/usb/ax88172a.c:191
 usbnet_probe+0xa9f/0x2770 drivers/net/usb/usbnet.c:1737
 usb_probe_interface+0x631/0xad0 drivers/usb/core/driver.c:361
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_set_configuration+0x197f/0x1f00 drivers/usb/core/message.c:2030
 generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2554
 hub_port_connect drivers/usb/core/hub.c:5123 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
 port_event drivers/usb/core/hub.c:5384 [inline]
 hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5466
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Freed by task 12:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471
 slab_free_hook mm/slub.c:1424 [inline]
 slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1457
 slab_free mm/slub.c:3014 [inline]
 kfree+0x12b/0x600 mm/slub.c:3975
 ax88172a_bind+0x844/0x980 drivers/net/usb/ax88172a.c:250
 usbnet_probe+0xa9f/0x2770 drivers/net/usb/usbnet.c:1737
 usb_probe_interface+0x631/0xad0 drivers/usb/core/driver.c:361
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_set_configuration+0x197f/0x1f00 drivers/usb/core/message.c:2030
 generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
 really_probe+0x764/0xf70 drivers/base/dd.c:560
 driver_probe_device+0xe6/0x230 drivers/base/dd.c:729
 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
 __device_attach+0x27b/0x420 drivers/base/dd.c:902
 bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
 device_add+0x13db/0x17c0 drivers/base/core.c:2644
 usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2554
 hub_port_connect drivers/usb/core/hub.c:5123 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
 port_event drivers/usb/core/hub.c:5384 [inline]
 hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5466
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8881ce38a500
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8881ce38a500, ffff8881ce38a540)
The buggy address belongs to the page:
page:ffffea000738e280 refcount:1 mapcount:0 mapping:ffff8881da803180 index:0xffff8881ce38ac80
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea000738e1c0 0000000700000007 ffff8881da803180
raw: ffff8881ce38ac80 0000000080200010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881ce38a400: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881ce38a480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881ce38a500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8881ce38a580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881ce38a600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
------------[ cut here ]------------
kernel BUG at drivers/net/phy/mdio_bus.c:456!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 12 Comm: kworker/0:1 Tainted: G    B             5.4.47-syzkaller-00290-g5eb96e454e88 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:mdiobus_unregister+0x1da/0x1e0 drivers/net/phy/mdio_bus.c:456
Code: f4 fe e9 80 fe ff ff 44 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c 94 fe ff ff 4c 89 ff e8 e0 db f4 fe e9 87 fe ff ff e8 16 b0 c6 fe <0f> 0b 0f 1f 40 00 41 57 41 56 41 55 41 54 53 49 89 ff 49 bc 00 00
RSP: 0018:ffff8881da9df620 EFLAGS: 00010293
RAX: ffffffff827b4caa RBX: 00000000725f7261 RCX: ffff8881da9b9f00
RDX: 0000000000000000 RSI: 00000000725f7261 RDI: 0000000000000002
RBP: 1ffff11039c715c3 R08: ffffffff827b4b16 R09: ffffed103b705df0
R10: ffffed103b705df0 R11: 0000000000000000 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff8881ce38ad80 R15: ffff8881ce38ae18
FS:  0000000000000000(0000) GS:ffff8881db800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f814ae93000 CR3: 00000001d36cb002 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ax88172a_remove_mdio drivers/net/usb/ax88172a.c:124 [inline]
 ax88172a_unbind+0x99/0xc0 drivers/net/usb/ax88172a.c:274
 usbnet_disconnect+0x14e/0x340 drivers/net/usb/usbnet.c:1618
 usb_unbind_interface+0x1d8/0x850 drivers/usb/core/driver.c:423
 __device_release_driver drivers/base/dd.c:1142 [inline]
 device_release_driver_internal+0x515/0x7b0 drivers/base/dd.c:1173
 bus_remove_device+0x2e7/0x350 drivers/base/bus.c:532
 device_del+0x7bc/0x1200 drivers/base/core.c:2821
 usb_disable_device+0x3fe/0xc90 drivers/usb/core/message.c:1244
 usb_disconnect+0x341/0x880 drivers/usb/core/hub.c:2217
 hub_port_connect drivers/usb/core/hub.c:4974 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5238 [inline]
 port_event drivers/usb/core/hub.c:5384 [inline]
 hub_event+0x1c6c/0x4fa0 drivers/usb/core/hub.c:5466
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
Modules linked in:
---[ end trace 100ac8b1bcd3041d ]---
RIP: 0010:mdiobus_unregister+0x1da/0x1e0 drivers/net/phy/mdio_bus.c:456
Code: f4 fe e9 80 fe ff ff 44 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c 94 fe ff ff 4c 89 ff e8 e0 db f4 fe e9 87 fe ff ff e8 16 b0 c6 fe <0f> 0b 0f 1f 40 00 41 57 41 56 41 55 41 54 53 49 89 ff 49 bc 00 00
RSP: 0018:ffff8881da9df620 EFLAGS: 00010293
RAX: ffffffff827b4caa RBX: 00000000725f7261 RCX: ffff8881da9b9f00
RDX: 0000000000000000 RSI: 00000000725f7261 RDI: 0000000000000002
RBP: 1ffff11039c715c3 R08: ffffffff827b4b16 R09: ffffed103b705df0
R10: ffffed103b705df0 R11: 0000000000000000 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff8881ce38ad80 R15: ffff8881ce38ae18
FS:  0000000000000000(0000) GS:ffff8881db800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f814ae99000 CR3: 00000001d36cb002 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (38):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/19 18:35 https://android.googlesource.com/kernel/common android-5.4 5eb96e454e88 123cf502 .config console log report syz C ci2-android-5-4-kasan
2020/04/03 16:24 https://android.googlesource.com/kernel/common android-5.4 13000e5761aa 5ed396e6 .config console log report syz C ci2-android-5-4-kasan
2020/07/28 01:48 https://android.googlesource.com/kernel/common android-5.4 ce64ca1ae06e cb93dc6a .config console log report ci2-android-5-4-kasan
2020/07/27 08:33 https://android.googlesource.com/kernel/common android-5.4 928d72f69121 cb93dc6a .config console log report ci2-android-5-4-kasan
2020/07/23 13:26 https://android.googlesource.com/kernel/common android-5.4 f51ce0659c2a 340ea530 .config console log report ci2-android-5-4-kasan
2020/07/22 15:25 https://android.googlesource.com/kernel/common android-5.4 e6cae5574a9a 128cd85f .config console log report ci2-android-5-4-kasan
2020/07/21 20:23 https://android.googlesource.com/kernel/common android-5.4 0c0d417747d8 e562dd8a .config console log report ci2-android-5-4-kasan
2020/07/11 08:35 https://android.googlesource.com/kernel/common android-5.4 70f740a59235 18d18b59 .config console log report ci2-android-5-4-kasan
2020/07/04 09:05 https://android.googlesource.com/kernel/common android-5.4 9e9a4c05a0b0 51095195 .config console log report ci2-android-5-4-kasan
2020/07/03 00:59 https://android.googlesource.com/kernel/common android-5.4 93dc81bbbde5 f30c14bf .config console log report ci2-android-5-4-kasan
2020/06/22 12:22 https://android.googlesource.com/kernel/common android-5.4 daa2cef41540 eabcced4 .config console log report ci2-android-5-4-kasan
2020/06/18 00:50 https://android.googlesource.com/kernel/common android-5.4 8e6c65a07bb4 d45a4d69 .config console log report ci2-android-5-4-kasan
2020/06/15 15:29 https://android.googlesource.com/kernel/common android-5.4 a191332e9e93 8e3ab941 .config console log report ci2-android-5-4-kasan
2020/06/03 06:48 https://android.googlesource.com/kernel/common android-5.4 f8aa5f514ccb f3ba1b5b .config console log report ci2-android-5-4-kasan
2020/06/02 05:20 https://android.googlesource.com/kernel/common android-5.4 9b26d323fe7a a0331e89 .config console log report ci2-android-5-4-kasan
2020/06/01 12:12 https://android.googlesource.com/kernel/common android-5.4 af2b56c502d6 a0331e89 .config console log report ci2-android-5-4-kasan
2020/05/29 20:45 https://android.googlesource.com/kernel/common android-5.4 80c0ec609c09 bed08304 .config console log report ci2-android-5-4-kasan
2020/05/28 08:09 https://android.googlesource.com/kernel/common android-5.4 413e6e69993f 9072c126 .config console log report ci2-android-5-4-kasan
2020/05/27 13:00 https://android.googlesource.com/kernel/common android-5.4 ea7bbd69ade9 9072c126 .config console log report ci2-android-5-4-kasan
2020/05/26 20:27 https://android.googlesource.com/kernel/common android-5.4 ea7bbd69ade9 9072c126 .config console log report ci2-android-5-4-kasan
2020/05/17 20:16 https://android.googlesource.com/kernel/common android-5.4 b818fc58f06b 37bccd4e .config console log report ci2-android-5-4-kasan
2020/05/17 16:45 https://android.googlesource.com/kernel/common android-5.4 b818fc58f06b 37bccd4e .config console log report ci2-android-5-4-kasan
2020/05/17 15:56 https://android.googlesource.com/kernel/common android-5.4 b818fc58f06b 37bccd4e .config console log report ci2-android-5-4-kasan
2020/05/17 13:46 https://android.googlesource.com/kernel/common android-5.4 b818fc58f06b 37bccd4e .config console log report ci2-android-5-4-kasan
2020/05/16 17:55 https://android.googlesource.com/kernel/common android-5.4 b818fc58f06b 37bccd4e .config console log report ci2-android-5-4-kasan
2020/05/11 08:32 https://android.googlesource.com/kernel/common android-5.4 d6943e6313ab f8f57555 .config console log report ci2-android-5-4-kasan
2020/05/11 05:25 https://android.googlesource.com/kernel/common android-5.4 d6943e6313ab 8742a2b9 .config console log report ci2-android-5-4-kasan
2020/05/09 13:34 https://android.googlesource.com/kernel/common android-5.4 2c3b4cba8ab3 e97b06d3 .config console log report ci2-android-5-4-kasan
2020/05/06 16:05 https://android.googlesource.com/kernel/common android-5.4 db0cef2fbf05 4618eb2d .config console log report ci2-android-5-4-kasan
2020/05/06 11:33 https://android.googlesource.com/kernel/common android-5.4 e52c85a3140c 35b8eb30 .config console log report ci2-android-5-4-kasan
2020/05/06 03:04 https://android.googlesource.com/kernel/common android-5.4 e52c85a3140c 35b8eb30 .config console log report ci2-android-5-4-kasan
2020/05/05 22:09 https://android.googlesource.com/kernel/common android-5.4 cb1091257636 4b76dd25 .config console log report ci2-android-5-4-kasan
2020/05/05 13:57 https://android.googlesource.com/kernel/common android-5.4 cb1091257636 4b76dd25 .config console log report ci2-android-5-4-kasan
2020/05/03 08:19 https://android.googlesource.com/kernel/common android-5.4 04ae7f0f4cb7 5457883a .config console log report ci2-android-5-4-kasan
2020/04/30 16:26 https://android.googlesource.com/kernel/common android-5.4 484d980ecf78 3698959a .config console log report ci2-android-5-4-kasan
2020/04/16 22:19 https://android.googlesource.com/kernel/common android-5.4 cb1f2700708a c743fcb3 .config console log report ci2-android-5-4-kasan
2020/04/15 12:21 https://android.googlesource.com/kernel/common android-5.4 a9154741b880 3f3c5574 .config console log report ci2-android-5-4-kasan
2020/04/12 14:01 https://android.googlesource.com/kernel/common android-5.4 fa41ab5369c7 36b0b050 .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.