syzbot


KASAN: use-after-free Read in em28xx_init_extension

Status: closed as dup on 2020/03/09 15:23
Subsystems: usb media
[Documentation on labels]
Reported-by: syzbot+e8fe6fd37e640743df98@syzkaller.appspotmail.com
First crash: 1668d, last: 962d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
BUG: corrupted list in em28xx_init_extension usb media C error 18 1000d 1545d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in em28xx_init_extension 1 (2) 2020/03/09 15:23
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in em28xx_init_extension (2) usb media C 3 22h44m 748d 0/26 upstream: reported C repro on 2022/03/30 17:36
upstream BUG: corrupted list in em28xx_init_extension usb media C error 18 1000d 1545d 20/26 fixed on 2022/03/08 16:11

Sample crash report:
em28xx 1-1:0.108: Audio interface 108 found (Vendor Class)
em28xx 1-1:0.108: unknown em28xx chip ID (0)
em28xx 1-1:0.108: Config register raw data: 0xfffffffb
em28xx 1-1:0.108: AC97 chip type couldn't be determined
em28xx 1-1:0.108: No AC97 audio processor
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x93/0xa0 lib/list_debug.c:26
Read of size 8 at addr ffff88803e918250 by task kworker/1:1/26

CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 5.14.0-rc7-syzkaller #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:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:436
 __list_add_valid+0x93/0xa0 lib/list_debug.c:26
 __list_add include/linux/list.h:67 [inline]
 list_add_tail include/linux/list.h:100 [inline]
 em28xx_init_extension+0x44/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1123
 em28xx_init_dev.constprop.0+0xa8b/0x172f drivers/media/usb/em28xx/em28xx-cards.c:3630
 em28xx_usb_probe.cold+0xc0c/0x2582 drivers/media/usb/em28xx/em28xx-cards.c:3979
 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3355
 usb_set_configuration+0x113a/0x1910 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238
 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3355
 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2563
 hub_port_connect drivers/usb/core/hub.c:5348 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5488 [inline]
 port_event drivers/usb/core/hub.c:5634 [inline]
 hub_event+0x2357/0x4330 drivers/usb/core/hub.c:5716
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 process_scheduled_works kernel/workqueue.c:2338 [inline]
 worker_thread+0x85c/0x11f0 kernel/workqueue.c:2424
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 26:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0xa1/0xd0 mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __do_kmalloc mm/slab.c:3702 [inline]
 __kmalloc_track_caller+0x212/0x4d0 mm/slab.c:3717
 kmemdup+0x23/0x50 mm/util.c:128
 kmemdup include/linux/fortify-string.h:270 [inline]
 em28xx_duplicate_dev drivers/media/usb/em28xx/em28xx-cards.c:3679 [inline]
 em28xx_usb_probe.cold+0x1314/0x2582 drivers/media/usb/em28xx/em28xx-cards.c:4027
 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3355
 usb_set_configuration+0x113a/0x1910 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238
 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3355
 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2563
 hub_port_connect drivers/usb/core/hub.c:5348 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5488 [inline]
 port_event drivers/usb/core/hub.c:5634 [inline]
 hub_event+0x2357/0x4330 drivers/usb/core/hub.c:5716
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2422
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 26:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 __cache_free mm/slab.c:3445 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3803
 __refcount_sub_and_test include/linux/refcount.h:282 [inline]
 __refcount_dec_and_test include/linux/refcount.h:315 [inline]
 refcount_dec_and_test include/linux/refcount.h:333 [inline]
 kref_put.constprop.0.isra.0+0x3d/0x7e include/linux/kref.h:64
 em28xx_usb_disconnect.cold+0x1c2/0x237 drivers/media/usb/em28xx/em28xx-cards.c:4147
 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458
 __device_release_driver+0x3bd/0x6f0 drivers/base/dd.c:1201
 device_release_driver_internal drivers/base/dd.c:1232 [inline]
 device_release_driver+0x26/0x40 drivers/base/dd.c:1255
 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529
 device_del+0x502/0xd40 drivers/base/core.c:3543
 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419
 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225
 hub_port_connect drivers/usb/core/hub.c:5199 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5488 [inline]
 port_event drivers/usb/core/hub.c:5634 [inline]
 hub_event+0x1c9c/0x4330 drivers/usb/core/hub.c:5716
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 process_scheduled_works kernel/workqueue.c:2338 [inline]
 worker_thread+0x85c/0x11f0 kernel/workqueue.c:2424
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88803e918000
 which belongs to the cache kmalloc-16k of size 16384
The buggy address is located 592 bytes inside of
 16384-byte region [ffff88803e918000, ffff88803e91c000)
The buggy address belongs to the page:
page:ffffea0000fa4600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3e918
head:ffffea0000fa4600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000fa4808 ffffea0000fa4408 ffff888010840b00
raw: 0000000000000000 ffff88803e918000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 26, ts 82066544454, free_ts 74289605934
 prep_new_page mm/page_alloc.c:2436 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 kmem_getpages mm/slab.c:1377 [inline]
 cache_grow_begin+0x75/0x460 mm/slab.c:2593
 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965
 ____cache_alloc mm/slab.c:3048 [inline]
 ____cache_alloc mm/slab.c:3031 [inline]
 __do_cache_alloc mm/slab.c:3275 [inline]
 slab_alloc mm/slab.c:3316 [inline]
 __do_kmalloc mm/slab.c:3700 [inline]
 __kmalloc_track_caller+0x3d3/0x4d0 mm/slab.c:3717
 kmemdup+0x23/0x50 mm/util.c:128
 kmemdup include/linux/fortify-string.h:270 [inline]
 em28xx_duplicate_dev drivers/media/usb/em28xx/em28xx-cards.c:3679 [inline]
 em28xx_usb_probe.cold+0x1314/0x2582 drivers/media/usb/em28xx/em28xx-cards.c:4027
 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3355
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1346 [inline]
 free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397
 free_unref_page_prepare mm/page_alloc.c:3332 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3411
 __put_page+0xf9/0x3f0 mm/swap.c:127
 put_page include/linux/mm.h:1246 [inline]
 __skb_frag_unref include/linux/skbuff.h:3102 [inline]
 skb_release_data+0x49d/0x790 net/core/skbuff.c:671
 skb_release_all net/core/skbuff.c:741 [inline]
 __kfree_skb+0x46/0x60 net/core/skbuff.c:755
 sk_eat_skb include/net/sock.h:2583 [inline]
 tcp_recvmsg_locked+0x12f7/0x2320 net/ipv4/tcp.c:2506
 tcp_recvmsg+0x134/0x550 net/ipv4/tcp.c:2552
 inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:852
 sock_recvmsg_nosec net/socket.c:943 [inline]
 sock_recvmsg net/socket.c:961 [inline]
 sock_recvmsg net/socket.c:957 [inline]
 sock_read_iter+0x33c/0x470 net/socket.c:1034
 call_read_iter include/linux/fs.h:2108 [inline]
 new_sync_read+0x5b7/0x6e0 fs/read_write.c:415
 vfs_read+0x35c/0x570 fs/read_write.c:496
 ksys_read+0x1ee/0x250 fs/read_write.c:634
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff88803e918100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88803e918180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88803e918200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88803e918280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88803e918300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/28 17:26 upstream 64b4fc45bea6 be2c130d .config console log report syz C ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in em28xx_init_extension
2021/08/03 10:01 upstream c500bee1c5b2 6c236867 .config console log report syz C ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in em28xx_init_extension
2020/02/08 22:48 https://github.com/google/kasan.git usb-fuzzer e5cd56e94edd 06150bf1 .config console log report syz C ci2-upstream-usb
2019/12/04 14:59 https://github.com/google/kasan.git usb-fuzzer 1f22d15c209f b2088328 .config console log report syz C ci2-upstream-usb
2019/09/22 09:38 https://github.com/google/kasan.git usb-fuzzer e0bd8d794fc9 d96e88f3 .config console log report syz C ci2-upstream-usb
2020/08/29 22:45 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 3ed8e1c2ac99 d5a3ae1f .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.