syzbot


KASAN: use-after-free Read in smsc95xx_mdio_read

Status: auto-closed as invalid on 2020/10/17 08:53
Reported-by: syzbot+85ada9d0642af8457aea@syzkaller.appspotmail.com
First crash: 1579d, last: 1571d

Sample crash report:
smsc95xx 6-1:1.0 eth1 (unregistering): Failed to read reg index 0x00000114: -19
smsc95xx 6-1:1.0 eth1 (unregistering): Error reading MII_ACCESS
==================================================================
BUG: KASAN: use-after-free in __smsc95xx_mdio_read drivers/net/usb/smsc95xx.c:188 [inline]
BUG: KASAN: use-after-free in smsc95xx_mdio_read+0x251/0x870 drivers/net/usb/smsc95xx.c:278
Read of size 8 at addr ffff8881c75889c8 by task kworker/1:2/91

CPU: 1 PID: 91 Comm: kworker/1:2 Not tainted 5.4.47-syzkaller-00290-g5eb96e454e88 #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_mdio_read drivers/net/usb/smsc95xx.c:188 [inline]
 smsc95xx_mdio_read+0x251/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 3116:
 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: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 3116:
 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:1519
 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: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

The buggy address belongs to the object at ffff8881c7588000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2504 bytes inside of
 4096-byte region [ffff8881c7588000, ffff8881c7589000)
The buggy address belongs to the page:
page:ffffea00071d6200 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:
 ffff8881c7588880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881c7588900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881c7588980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8881c7588a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881c7588a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
usb ρ, (unnamed net_device) (released): MII is busy in smsc95xx_mdio_read
usb ρ, (unnamed net_device) (released): Failed to read MII_BMSR
usb 4-1: new high-speed USB device number 17 using dummy_hcd
usb 4-1: unable to get BOS descriptor or descriptor too short
usb 4-1: config 1 has an invalid interface number: 2 but max is 1
usb 4-1: config 1 contains an unexpected descriptor of type 0x1, skipping
usb 4-1: config 1 has an invalid descriptor of length 0, skipping remainder of the config
usb 4-1: config 1 has 1 interface, different from the descriptor's value: 2
usb 4-1: config 1 has no interface number 0
usb 4-1: config 1 interface 2 altsetting 0 has 0 endpoint descriptors, different from the interface descriptor's value: 1
usb 4-1: New USB device found, idVendor=0525, idProduct=a4a1, bcdDevice= 0.40
usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 4-1: Product: syz
usb 4-1: Manufacturer: syz
usb 4-1: SerialNumber: syz
cdc_ncm 4-1:1.2: skipping garbage
cdc_ncm 4-1:1.2: skipping garbage
cdc_ncm 4-1:1.2: invalid descriptor buffer length
cdc_ncm 4-1:1.2: bind() failure
usb 4-1: USB disconnect, device number 17
usb 4-1: new high-speed USB device number 18 using dummy_hcd
usb 4-1: unable to get BOS descriptor or descriptor too short
usb 4-1: config 1 has an invalid interface number: 2 but max is 1
usb 4-1: config 1 contains an unexpected descriptor of type 0x1, skipping
usb 4-1: config 1 has an invalid descriptor of length 0, skipping remainder of the config
usb 4-1: config 1 has 1 interface, different from the descriptor's value: 2
usb 4-1: config 1 has no interface number 0
usb 4-1: config 1 interface 2 altsetting 0 has 0 endpoint descriptors, different from the interface descriptor's value: 1
usb 4-1: New USB device found, idVendor=0525, idProduct=a4a1, bcdDevice= 0.40
usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 4-1: Product: syz
usb 4-1: Manufacturer: syz
usb 4-1: SerialNumber: syz
cdc_ncm 4-1:1.2: skipping garbage
cdc_ncm 4-1:1.2: skipping garbage
cdc_ncm 4-1:1.2: invalid descriptor buffer length
cdc_ncm 4-1:1.2: bind() failure
usb 4-1: USB disconnect, device number 18

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/06/19 08:53 https://android.googlesource.com/kernel/common android-5.4 5eb96e454e88 bc258b50 .config console log report ci2-android-5-4-kasan
2020/06/17 22:20 https://android.googlesource.com/kernel/common android-5.4 8e6c65a07bb4 b6c46f43 .config console log report ci2-android-5-4-kasan
2020/06/16 18:44 https://android.googlesource.com/kernel/common android-5.4 30c93f3226d8 4ea9d964 .config console log report ci2-android-5-4-kasan
2020/06/11 22:46 https://android.googlesource.com/kernel/common android-5.4 91d2b0a4c0ab 1beaee21 .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.