syzbot


KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb (2)

Status: auto-closed as invalid on 2021/11/06 06:14
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+b9cf90b95939f53f87c3@syzkaller.appspotmail.com
First crash: 985d, last: 985d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb wireless 5 1121d 1254d 0/26 auto-closed as invalid on 2021/07/22 20:31
upstream KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb (3) wireless C inconclusive done 19 536d 808d 0/26 auto-obsoleted due to no activity on 2023/04/20 02:46

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:147 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1062 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x2e/0x3f0 net/core/skbuff.c:769
Read of size 4 at addr ffff888031e8365c by task syz-executor.5/29572

CPU: 1 PID: 29572 Comm: syz-executor.5 Not tainted 5.14.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 atomic_read include/asm-generic/atomic-instrumented.h:27 [inline]
 refcount_read include/linux/refcount.h:147 [inline]
 skb_unref include/linux/skbuff.h:1062 [inline]
 kfree_skb+0x2e/0x3f0 net/core/skbuff.c:769
 ath9k_hif_usb_reg_in_cb+0x4c0/0x630 drivers/net/wireless/ath/ath9k/hif_usb.c:764
 __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1656
 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1726
 dummy_timer+0x11f9/0x32b0 drivers/usb/gadget/udc/dummy_hcd.c:1987
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1419
 expire_timers kernel/time/timer.c:1464 [inline]
 __run_timers.part.0+0x675/0xa50 kernel/time/timer.c:1732
 __run_timers kernel/time/timer.c:1713 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1745
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x16e/0x1c0 kernel/softirq.c:636
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:device_del+0x4fd/0xd40 drivers/base/core.c:3542
Code: 85 db 74 16 e8 14 a5 12 fd 31 d2 48 c7 c6 60 2a 44 8c 48 89 df e8 c3 d5 8f fd e8 fe a4 12 fd 48 89 df e8 06 bf ff ff 48 89 df <e8> 8e 1c 01 00 48 89 df e8 e6 2c 05 00 48 89 df e8 9e 45 01 00 be
RSP: 0018:ffffc90002087710 EFLAGS: 00000246
RAX: 0000000000040000 RBX: ffff8880a4239010 RCX: ffffc90013e74000
RDX: 0000000000040000 RSI: ffffffff84623c4a RDI: ffff8880a4239010
RBP: ffff8880a423946c R08: 0000000000000001 R09: 000000008a278f00
R10: ffffffff81f16331 R11: 0000000000000000 R12: 0000000000000000
R13: ffffed101445a401 R14: 0000000000000006 R15: dffffc0000000000
 device_unregister+0x1f/0xc0 drivers/base/core.c:3575
 usb_remove_ep_devs+0x3e/0x80 drivers/usb/core/endpoint.c:188
 remove_intf_ep_devs drivers/usb/core/message.c:1267 [inline]
 usb_disable_device+0x306/0x7b0 drivers/usb/core/message.c:1418
 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225
 hub_quiesce+0x170/0x310 drivers/usb/core/hub.c:1327
 hub_disconnect+0xcb/0x510 drivers/usb/core/hub.c:1722
 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
 usb_driver_release_interface+0x102/0x180 drivers/usb/core/driver.c:627
 proc_disconnect_claim+0x217/0x380 drivers/usb/core/devio.c:2386
 usbdev_do_ioctl drivers/usb/core/devio.c:2669 [inline]
 usbdev_ioctl+0x2b45/0x36c0 drivers/usb/core/devio.c:2713
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:1069 [inline]
 __se_sys_ioctl fs/ioctl.c:1055 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055
 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
RIP: 0033:0x4665e9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8743169188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9
RDX: 0000000020000380 RSI: 000000008108551b RDI: 0000000000000004
RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80
R13: 00007ffd5964970f R14: 00007f8743169300 R15: 0000000000022000

Allocated by task 12518:
 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_slab_alloc+0x81/0xa0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook mm/slab.h:519 [inline]
 slab_alloc_node mm/slab.c:3261 [inline]
 kmem_cache_alloc_node+0x31d/0x590 mm/slab.c:3599
 __alloc_skb+0x20b/0x340 net/core/skbuff.c:414
 alloc_skb include/linux/skbuff.h:1112 [inline]
 ath9k_hif_usb_alloc_reg_in_urbs drivers/net/wireless/ath/ath9k/hif_usb.c:957 [inline]
 ath9k_hif_usb_alloc_urbs+0x92b/0x1040 drivers/net/wireless/ath/ath9k/hif_usb.c:1016
 ath9k_hif_usb_dev_init drivers/net/wireless/ath/ath9k/hif_usb.c:1102 [inline]
 ath9k_hif_usb_firmware_cb+0x148/0x530 drivers/net/wireless/ath/ath9k/hif_usb.c:1235
 request_firmware_work_func+0x12c/0x230 drivers/base/firmware_loader/main.c:1081
 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 29572:
 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+0xcd/0x100 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 __cache_free mm/slab.c:3445 [inline]
 kmem_cache_free+0x68/0x200 mm/slab.c:3740
 kfree_skbmem+0xef/0x1b0 net/core/skbuff.c:699
 __kfree_skb net/core/skbuff.c:756 [inline]
 kfree_skb net/core/skbuff.c:773 [inline]
 kfree_skb+0x140/0x3f0 net/core/skbuff.c:767
 ath9k_htc_rx_msg+0x1eb/0xb70 drivers/net/wireless/ath/ath9k/htc_hst.c:451
 ath9k_hif_usb_reg_in_cb+0x1ac/0x630 drivers/net/wireless/ath/ath9k/hif_usb.c:733
 __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1656
 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1726
 dummy_timer+0x11f9/0x32b0 drivers/usb/gadget/udc/dummy_hcd.c:1987
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1419
 expire_timers kernel/time/timer.c:1464 [inline]
 __run_timers.part.0+0x675/0xa50 kernel/time/timer.c:1732
 __run_timers kernel/time/timer.c:1713 [inline]
 run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1745
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558

The buggy address belongs to the object at ffff888031e83580
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 220 bytes inside of
 232-byte region [ffff888031e83580, ffff888031e83668)
The buggy address belongs to the page:
page:ffffea0000c7a0c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x31e83
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00007bb708 ffffea0000857308 ffff888011fb9c00
raw: 0000000000000000 ffff888031e83080 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x242220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 12198, ts 397278551642, free_ts 392629215014
 prep_new_page mm/page_alloc.c:2436 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4169
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5391
 __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]
 slab_alloc_node mm/slab.c:3249 [inline]
 kmem_cache_alloc_node+0x4a1/0x590 mm/slab.c:3599
 __alloc_skb+0x20b/0x340 net/core/skbuff.c:414
 alloc_skb include/linux/skbuff.h:1112 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:664 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:721 [inline]
 nsim_dev_trap_report_work+0x2ac/0xbd0 drivers/net/netdevsim/dev.c:762
 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
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
 slab_destroy mm/slab.c:1627 [inline]
 slabs_destroy+0x89/0xc0 mm/slab.c:1647
 cache_flusharray mm/slab.c:3418 [inline]
 ___cache_free+0x4c6/0x610 mm/slab.c:3480
 qlink_free mm/kasan/quarantine.c:146 [inline]
 qlist_free_all+0x4e/0x110 mm/kasan/quarantine.c:165
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x8b/0xa0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook mm/slab.h:519 [inline]
 slab_alloc mm/slab.c:3323 [inline]
 kmem_cache_alloc+0x25f/0x540 mm/slab.c:3507
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 ext4_init_io_end+0x23/0x170 fs/ext4/page-io.c:276
 ext4_writepages+0x8fd/0x3ba0 fs/ext4/inode.c:2749
 do_writepages+0xec/0x290 mm/page-writeback.c:2355
 __writeback_single_inode+0x126/0xff0 fs/fs-writeback.c:1613
 writeback_sb_inodes+0x53d/0xf00 fs/fs-writeback.c:1878
 __writeback_inodes_wb+0xc6/0x280 fs/fs-writeback.c:1947
 wb_writeback+0x814/0xc50 fs/fs-writeback.c:2053
 wb_check_old_data_flush fs/fs-writeback.c:2155 [inline]
 wb_do_writeback fs/fs-writeback.c:2208 [inline]
 wb_workfn+0x8cf/0x12d0 fs/fs-writeback.c:2237

Memory state around the buggy address:
 ffff888031e83500: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
 ffff888031e83580: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888031e83600: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
                                                    ^
 ffff888031e83680: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
 ffff888031e83700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/08 06:13 upstream 85a90500f9a1 6972b106 .config console log report info ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ath9k_hif_usb_reg_in_cb
* Struck through repros no longer work on HEAD.