KASAN: use-after-free Read in ax88172a_unbind

9 views
Skip to first unread message

syzbot

unread,
Apr 3, 2020, 12:25:15 PM4/3/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 13000e57 ANDROID: Incremental fs: Fix four resource bugs
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=14cd0cfbe00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a8756dec99c3c806
dashboard link: https://syzkaller.appspot.com/bug?extid=4f918b67a92902adfad4
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15424e0be00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1411a4b3e00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4f918b...@syzkaller.appspotmail.com

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 ffff8881cf4d5580 by task kworker/1:1/115

CPU: 1 PID: 115 Comm: kworker/1:1 Not tainted 5.4.30-syzkaller-00977-g13000e5761aa #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+0x14b/0x340 drivers/net/usb/usbnet.c:1618
usb_unbind_interface+0x1cf/0x840 drivers/usb/core/driver.c:423
__device_release_driver drivers/base/dd.c:1137 [inline]
device_release_driver_internal+0x505/0x790 drivers/base/dd.c:1168
bus_remove_device+0x2e0/0x350 drivers/base/bus.c:532
device_del+0x7a7/0x11f0 drivers/base/core.c:2684
usb_disable_device+0x3f3/0xb80 drivers/usb/core/message.c:1237
usb_disconnect+0x341/0x880 drivers/usb/core/hub.c:2211
hub_port_connect drivers/usb/core/hub.c:4961 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5225 [inline]
port_event drivers/usb/core/hub.c:5371 [inline]
hub_event+0x1c44/0x4fc0 drivers/usb/core/hub.c:5453
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 115:
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/0x270 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+0xa8f/0x2760 drivers/net/usb/usbnet.c:1737
usb_probe_interface+0x621/0xac0 drivers/usb/core/driver.c:361
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_set_configuration+0x184c/0x1dc0 drivers/usb/core/message.c:2023
generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_new_device+0x9ba/0xfc0 drivers/usb/core/hub.c:2548
hub_port_connect drivers/usb/core/hub.c:5110 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5225 [inline]
port_event drivers/usb/core/hub.c:5371 [inline]
hub_event+0x28eb/0x4fc0 drivers/usb/core/hub.c:5453
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 115:
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/0x140 mm/slub.c:1457
slab_free mm/slub.c:3014 [inline]
kfree+0x12b/0x5f0 mm/slub.c:3975
ax88172a_bind+0x844/0x980 drivers/net/usb/ax88172a.c:250
usbnet_probe+0xa8f/0x2760 drivers/net/usb/usbnet.c:1737
usb_probe_interface+0x621/0xac0 drivers/usb/core/driver.c:361
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_set_configuration+0x184c/0x1dc0 drivers/usb/core/message.c:2023
generic_probe+0x82/0x140 drivers/usb/core/generic.c:210
really_probe+0x75b/0xf50 drivers/base/dd.c:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x275/0x410 drivers/base/dd.c:897
bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490
device_add+0x1054/0x1740 drivers/base/core.c:2507
usb_new_device+0x9ba/0xfc0 drivers/usb/core/hub.c:2548
hub_port_connect drivers/usb/core/hub.c:5110 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5225 [inline]
port_event drivers/usb/core/hub.c:5371 [inline]
hub_event+0x28eb/0x4fc0 drivers/usb/core/hub.c:5453
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 ffff8881cf4d5580
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
64-byte region [ffff8881cf4d5580, ffff8881cf4d55c0)
The buggy address belongs to the page:
page:ffffea00073d3540 refcount:1 mapcount:0 mapping:ffff8881da803600 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 0000000000000000 0000000100000001 ffff8881da803600
raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881cf4d5480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881cf4d5500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881cf4d5580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8881cf4d5600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881cf4d5680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
kernel BUG at drivers/net/phy/mdio_bus.c:456!
CPU: 1 PID: 115 Comm: kworker/1:1 Tainted: G B 5.4.30-syzkaller-00977-g13000e5761aa #0
RIP: 0010:mdiobus_unregister+0x1da/0x1e0 drivers/net/phy/mdio_bus.c:456
RSP: 0018:ffff8881d9d37640 EFLAGS: 00010293
RAX: ffffffff827585ca RBX: 0000000000000000 RCX: ffff8881d9d28f40
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000002
RBP: 1ffff11039b92013 R08: ffffffff82758436 R09: ffffed103b725de0
R10: ffffed103b725de0 R11: 0000000000000000 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff8881cdc90000 R15: ffff8881cdc90098
FS: 0000000000000000(0000) GS:ffff8881db900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd5b00f0740 CR3: 00000001d64e0003 CR4: 00000000001606e0
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+0x14b/0x340 drivers/net/usb/usbnet.c:1618
usb_unbind_interface+0x1cf/0x840 drivers/usb/core/driver.c:423
__device_release_driver drivers/base/dd.c:1137 [inline]
device_release_driver_internal+0x505/0x790 drivers/base/dd.c:1168
bus_remove_device+0x2e0/0x350 drivers/base/bus.c:532
device_del+0x7a7/0x11f0 drivers/base/core.c:2684
usb_disable_device+0x3f3/0xb80 drivers/usb/core/message.c:1237
usb_disconnect+0x341/0x880 drivers/usb/core/hub.c:2211
hub_port_connect drivers/usb/core/hub.c:4961 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5225 [inline]
port_event drivers/usb/core/hub.c:5371 [inline]
hub_event+0x1c44/0x4fc0 drivers/usb/core/hub.c:5453
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 988821328f4face9 ]---
RIP: 0010:mdiobus_unregister+0x1da/0x1e0 drivers/net/phy/mdio_bus.c:456
Code: fa 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 20 56 fa fe e9 87 fe ff ff e8 76 31 cc 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:ffff8881d9d37640 EFLAGS: 00010293
RAX: ffffffff827585ca RBX: 0000000000000000 RCX: ffff8881d9d28f40
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000002
RBP: 1ffff11039b92013 R08: ffffffff82758436 R09: ffffed103b725de0
R10: ffffed103b725de0 R11: 0000000000000000 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffff8881cdc90000 R15: ffff8881cdc90098
FS: 0000000000000000(0000) GS:ffff8881db900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd5b00f0740 CR3: 00000001d64e0003 CR4: 00000000001606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages