KASAN: use-after-free Read in smsc95xx_mdio_read

5 views
Skip to first unread message

syzbot

unread,
Jun 11, 2020, 6:46:16 PM6/11/20
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 91d2b0a4 UPSTREAM: usb: musb: Add support for MediaTek mus..
git tree: android-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=17c97689100000
kernel config: https://syzkaller.appspot.com/x/.config?x=4ae8d7ed763ae940
dashboard link: https://syzkaller.appspot.com/bug?extid=85ada9d0642af8457aea
compiler: Android (6032204 based on r370808) clang version 10.0.1 (https://android.googlesource.com/toolchain/llvm-project 6e765c10313d15c02ab29977a82938f66742c3a9)

Unfortunately, I don't have any reproducer for this crash yet.

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

==================================================================
BUG: KASAN: use-after-free in __smsc95xx_phy_wait_not_busy drivers/net/usb/smsc95xx.c:165 [inline]
BUG: KASAN: use-after-free in __smsc95xx_mdio_read drivers/net/usb/smsc95xx.c:186 [inline]
BUG: KASAN: use-after-free in smsc95xx_mdio_read+0x635/0x870 drivers/net/usb/smsc95xx.c:278
Read of size 8 at addr ffff8881cafd29c8 by task kworker/1:2/140

CPU: 1 PID: 140 Comm: kworker/1:2 Not tainted 5.4.46-syzkaller-00098-g91d2b0a4c0ab #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events check_carrier
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
__smsc95xx_phy_wait_not_busy drivers/net/usb/smsc95xx.c:165 [inline]
__smsc95xx_mdio_read drivers/net/usb/smsc95xx.c:186 [inline]
smsc95xx_mdio_read+0x635/0x870 drivers/net/usb/smsc95xx.c:278
check_carrier+0xd1/0x2e0 drivers/net/usb/smsc95xx.c:644
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 10034:
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
__kmalloc+0xf7/0x2d0 mm/slub.c:3821
__kmalloc_node include/linux/slab.h:422 [inline]
kmalloc_node include/linux/slab.h:599 [inline]
kvmalloc_node+0xc2/0x120 mm/util.c:564
kvmalloc include/linux/mm.h:678 [inline]
kvzalloc include/linux/mm.h:686 [inline]
alloc_netdev_mqs+0x85/0xc60 net/core/dev.c:9498
usbnet_probe+0x1ae/0x2770 drivers/net/usb/usbnet.c:1686
usb_probe_interface+0x631/0xad0 drivers/usb/core/driver.c:361
really_probe+0x764/0xf70 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+0x27b/0x420 drivers/base/dd.c:897
bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
device_add+0x105a/0x1750 drivers/base/core.c:2544
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:555
driver_probe_device+0xe6/0x230 drivers/base/dd.c:724
bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430
__device_attach+0x27b/0x420 drivers/base/dd.c:897
bus_probe_device+0xbb/0x200 drivers/base/bus.c:490
device_add+0x105a/0x1750 drivers/base/core.c:2544
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 240:
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
device_release+0x70/0x1a0 drivers/base/core.c:1408
kobject_cleanup lib/kobject.c:693 [inline]
kobject_release lib/kobject.c:722 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1a9/0x250 lib/kobject.c:739
usb_unbind_interface+0x1d8/0x850 drivers/usb/core/driver.c:423
__device_release_driver drivers/base/dd.c:1137 [inline]
device_release_driver_internal+0x515/0x7b0 drivers/base/dd.c:1168
bus_remove_device+0x2e7/0x350 drivers/base/bus.c:532
device_del+0x7bc/0x1200 drivers/base/core.c:2721
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

The buggy address belongs to the object at ffff8881cafd2000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2504 bytes inside of
4096-byte region [ffff8881cafd2000, ffff8881cafd3000)
The buggy address belongs to the page:
page:ffffea00072bf400 refcount:1 mapcount:0 mapping:ffff8881da80c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 0000000000000000 0000000100000001 ffff8881da80c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881cafd2880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881cafd2900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881cafd2980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881cafd2a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881cafd2a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
usb @��ف���2' (unnamed net_device) (released): Error reading MII_ACCESS
usb @��ف���2' (unnamed net_device) (released): MII is busy in smsc95xx_mdio_read
usb @��ف���2' (unnamed net_device) (released): Failed to read MII_BMSR


---
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

unread,
Oct 17, 2020, 4:53:11 AM10/17/20
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages