KASAN: out-of-bounds Read in ath9k_hif_usb_rx_cb (3)

27 views
Skip to first unread message

syzbot

unread,
Jan 5, 2021, 11:03:24 AM1/5/21
to andre...@google.com, ath9k...@qca.qualcomm.com, da...@davemloft.net, ku...@kernel.org, kv...@codeaurora.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3644e2d2 mm/filemap: fix infinite loop in generic_file_buf..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=1669d8c5500000
kernel config: https://syzkaller.appspot.com/x/.config?x=ff698e602d15ad28
dashboard link: https://syzkaller.appspot.com/bug?extid=3f1ca6a6fec34d601788
compiler: gcc (GCC) 10.1.0-syz 20200507

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

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3f1ca6...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: out-of-bounds in ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
BUG: KASAN: out-of-bounds in ath9k_hif_usb_rx_cb+0xdab/0x1020 drivers/net/wireless/ath/ath9k/hif_usb.c:680
Read of size 4 at addr ffff888112be40b8 by task systemd-journal/2634

CPU: 0 PID: 2634 Comm: systemd-journal Not tainted 5.10.0-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:79 [inline]
dump_stack+0x107/0x163 lib/dump_stack.c:120
print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385
__kasan_report mm/kasan/report.c:545 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
ath9k_hif_usb_rx_cb+0xdab/0x1020 drivers/net/wireless/ath/ath9k/hif_usb.c:680
__usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1657
usb_hcd_giveback_urb+0x38c/0x430 drivers/usb/core/hcd.c:1728
dummy_timer+0x11f4/0x32a0 drivers/usb/gadget/udc/dummy_hcd.c:1971
call_timer_fn+0x1a5/0x690 kernel/time/timer.c:1417
expire_timers kernel/time/timer.c:1462 [inline]
__run_timers.part.0+0x692/0xa50 kernel/time/timer.c:1731
__run_timers kernel/time/timer.c:1712 [inline]
run_timer_softirq+0x80/0x120 kernel/time/timer.c:1744
__do_softirq+0x1b7/0x9c5 kernel/softirq.c:343
asm_call_irq_on_stack+0xf/0x20
</IRQ>
__run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
do_softirq_own_stack+0x80/0xa0 arch/x86/kernel/irq_64.c:77
invoke_softirq kernel/softirq.c:226 [inline]
__irq_exit_rcu+0x119/0x1b0 kernel/softirq.c:420
irq_exit_rcu+0x5/0x10 kernel/softirq.c:432
sysvec_apic_timer_interrupt+0x43/0xa0 arch/x86/kernel/apic/apic.c:1096
asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:628
RIP: 0010:devkmsg_read+0x3df/0x750 kernel/printk/printk.c:754
Code: 01 80 3c 02 00 0f 85 19 03 00 00 48 c7 c7 c0 95 66 87 4c 89 6d 00 e8 00 0d 97 04 e8 0b 4b 00 00 e8 b6 4e 1c 00 fb 48 8b 2c 24 <4c> 89 ff 48 c7 c3 ea ff ff ff 48 89 ee e8 df 96 16 00 49 39 ef 77
RSP: 0018:ffffc90000247d68 EFLAGS: 00000202
RAX: 0000000001f89e25 RBX: ffff88810ef320f8 RCX: ffffffff8126e037
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8129b43a
RBP: 0000000000002000 R08: 0000000000000001 R09: ffffffff8a02c65f
R10: fffffbfff14058cb R11: 000000000000005c R12: 1ffff92000048fb2
R13: 000000000000ab98 R14: ffff88810ef30068 R15: 000000000000009a
vfs_read+0x1b5/0x570 fs/read_write.c:494
ksys_read+0x12d/0x250 fs/read_write.c:634
do_syscall_64+0x2d/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7ffbb8d4f210
Code: 73 01 c3 48 8b 0d 98 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d b9 c1 20 00 00 75 10 b8 00 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 4e fc ff ff 48 89 04 24
RSP: 002b:00007ffdc194c458 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007ffdc194eed0 RCX: 00007ffbb8d4f210
RDX: 0000000000002000 RSI: 00007ffdc194ccd0 RDI: 0000000000000009
RBP: 0000000000000000 R08: 0000000000000008 R09: 00007ffdc19c20f0
R10: 000000000002c96e R11: 0000000000000246 R12: 00007ffdc194ccd0
R13: 00007ffdc194ee28 R14: 00005646a13bb958 R15: 0005b6f3706fc2a9

Allocated by task 31546:
kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
kasan_set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461
slab_post_alloc_hook mm/slab.h:512 [inline]
slab_alloc_node mm/slub.c:2889 [inline]
__kmalloc_node_track_caller+0x1a2/0x340 mm/slub.c:4493
__kmalloc_reserve net/core/skbuff.c:142 [inline]
__alloc_skb+0xae/0x5c0 net/core/skbuff.c:210
__netdev_alloc_skb+0x6b/0x3b0 net/core/skbuff.c:442
netdev_alloc_skb include/linux/skbuff.h:2831 [inline]
dev_alloc_skb include/linux/skbuff.h:2844 [inline]
ath6kl_usb_post_recv_transfers.constprop.0+0x55/0x400 drivers/net/wireless/ath/ath6kl/usb.c:422
ath6kl_usb_start_recv_pipes drivers/net/wireless/ath/ath6kl/usb.c:492 [inline]
hif_start drivers/net/wireless/ath/ath6kl/usb.c:690 [inline]
ath6kl_usb_power_on+0x8a/0x150 drivers/net/wireless/ath/ath6kl/usb.c:1049
ath6kl_hif_power_on drivers/net/wireless/ath/ath6kl/hif-ops.h:136 [inline]
ath6kl_core_init drivers/net/wireless/ath/ath6kl/core.c:97 [inline]
ath6kl_core_init+0x1ae/0x1170 drivers/net/wireless/ath/ath6kl/core.c:66
ath6kl_usb_probe+0xc3d/0x11f0 drivers/net/wireless/ath/ath6kl/usb.c:1155
usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
really_probe+0x2b1/0xe40 drivers/base/dd.c:561
driver_probe_device+0x285/0x3f0 drivers/base/dd.c:745
__device_attach_driver+0x216/0x2d0 drivers/base/dd.c:851
bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431
__device_attach+0x228/0x4c0 drivers/base/dd.c:919
bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491
device_add+0xbc4/0x1d90 drivers/base/core.c:3091
usb_set_configuration+0x113c/0x1910 drivers/usb/core/message.c:2164
usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238
usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293
really_probe+0x2b1/0xe40 drivers/base/dd.c:561
driver_probe_device+0x285/0x3f0 drivers/base/dd.c:745
__device_attach_driver+0x216/0x2d0 drivers/base/dd.c:851
bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431
__device_attach+0x228/0x4c0 drivers/base/dd.c:919
bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491
device_add+0xbc4/0x1d90 drivers/base/core.c:3091
usb_new_device.cold+0x725/0x1057 drivers/usb/core/hub.c:2555
hub_port_connect drivers/usb/core/hub.c:5223 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5363 [inline]
port_event drivers/usb/core/hub.c:5509 [inline]
hub_event+0x2348/0x42d0 drivers/usb/core/hub.c:5591
process_one_work+0x98d/0x15c0 kernel/workqueue.c:2275
process_scheduled_works kernel/workqueue.c:2337 [inline]
worker_thread+0x82b/0x1120 kernel/workqueue.c:2423
kthread+0x38c/0x460 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

The buggy address belongs to the object at ffff888112be4000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 184 bytes inside of
8192-byte region [ffff888112be4000, ffff888112be6000)
The buggy address belongs to the page:
page:0000000066b7dcb8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112be0
head:0000000066b7dcb8 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x200000000010200(slab|head)
raw: 0200000000010200 dead000000000100 dead000000000122 ffff888100042280
raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888112be3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888112be4000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888112be4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff888112be4100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888112be4180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
This report 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 issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Jun 6, 2021, 5:16:16 PM6/6/21
to andre...@google.com, ath9k...@qca.qualcomm.com, da...@davemloft.net, ku...@kernel.org, kv...@codeaurora.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f5b6eb1e Merge branch 'i2c/for-current' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12fa1797d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=8a9e9956ca52a5f6
dashboard link: https://syzkaller.appspot.com/bug?extid=3f1ca6a6fec34d601788
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=158914ebd00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17720670300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3f1ca6...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: out-of-bounds in ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
BUG: KASAN: out-of-bounds in ath9k_hif_usb_rx_cb+0xdd8/0x1050 drivers/net/wireless/ath/ath9k/hif_usb.c:680
Read of size 4 at addr ffff888036db4178 by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.13.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:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
ath9k_hif_usb_rx_cb+0xdd8/0x1050 drivers/net/wireless/ath/ath9k/hif_usb.c:680
__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+0x11f4/0x32a0 drivers/usb/gadget/udc/dummy_hcd.c:1978
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1431
expire_timers kernel/time/timer.c:1476 [inline]
__run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1745
__run_timers kernel/time/timer.c:1726 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1758
__do_softirq+0x29b/0x9f6 kernel/softirq.c:559
invoke_softirq kernel/softirq.c:433 [inline]
__irq_exit_rcu+0x136/0x200 kernel/softirq.c:637
irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
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:647
RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:29 [inline]
RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
RIP: 0010:arch_irqs_disabled arch/x86/include/asm/irqflags.h:132 [inline]
RIP: 0010:acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline]
RIP: 0010:acpi_idle_do_entry+0x1c9/0x250 drivers/acpi/processor_idle.c:513
Code: ed b0 5b f8 84 db 75 ac e8 34 aa 5b f8 e8 ef b9 61 f8 e9 0c 00 00 00 e8 25 aa 5b f8 0f 00 2d 5e 48 b5 00 e8 19 aa 5b f8 fb f4 <9c> 5b 81 e3 00 02 00 00 fa 31 ff 48 89 de e8 24 b2 5b f8 48 85 db
RSP: 0018:ffffc90000d57d18 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff8880123dd4c0 RSI: ffffffff89193267 RDI: 0000000000000000
RBP: ffff8881427b7864 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff817aec78 R11: 0000000000000000 R12: 0000000000000001
R13: ffff8881427b7800 R14: ffff8881427b7864 R15: ffff88801c850804
acpi_idle_enter+0x361/0x500 drivers/acpi/processor_idle.c:648
cpuidle_enter_state+0x1b1/0xc80 drivers/cpuidle/cpuidle.c:237
cpuidle_enter+0x4a/0xa0 drivers/cpuidle/cpuidle.c:351
call_cpuidle kernel/sched/idle.c:158 [inline]
cpuidle_idle_call kernel/sched/idle.c:239 [inline]
do_idle+0x3e8/0x590 kernel/sched/idle.c:306
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:403
start_secondary+0x274/0x350 arch/x86/kernel/smpboot.c:272
secondary_startup_64_no_verify+0xb0/0xbb

Allocated by task 11245:
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:428 [inline]
____kasan_kmalloc mm/kasan/common.c:507 [inline]
____kasan_kmalloc mm/kasan/common.c:466 [inline]
__kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516
kmalloc include/linux/slab.h:561 [inline]
raw_alloc_io_data drivers/usb/gadget/legacy/raw_gadget.c:593 [inline]
raw_alloc_io_data+0x157/0x1c0 drivers/usb/gadget/legacy/raw_gadget.c:577
raw_ioctl_ep0_read drivers/usb/gadget/legacy/raw_gadget.c:694 [inline]
raw_ioctl+0x110b/0x2720 drivers/usb/gadget/legacy/raw_gadget.c:1223
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_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff888036db4000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 376 bytes inside of
4096-byte region [ffff888036db4000, ffff888036db5000)
The buggy address belongs to the page:
page:ffffea0000db6c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x36db0
head:ffffea0000db6c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011042140
raw: 0000000000000000 0000000000040004 00000001ffffffff 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4855, ts 492416671090, free_ts 492416389440
prep_new_page mm/page_alloc.c:2358 [inline]
get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200
alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
alloc_slab_page mm/slub.c:1645 [inline]
allocate_slab+0x2c5/0x4c0 mm/slub.c:1785
new_slab mm/slub.c:1848 [inline]
new_slab_objects mm/slub.c:2594 [inline]
___slab_alloc+0x4a1/0x810 mm/slub.c:2757
__slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2797
slab_alloc_node mm/slub.c:2879 [inline]
slab_alloc mm/slub.c:2921 [inline]
__kmalloc+0x315/0x330 mm/slub.c:4055
kmalloc include/linux/slab.h:561 [inline]
tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
security_inode_getattr+0xcf/0x140 security/security.c:1332
vfs_getattr fs/stat.c:139 [inline]
vfs_fstat+0x43/0xb0 fs/stat.c:164
__do_sys_newfstat+0x81/0x100 fs/stat.c:404
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1298 [inline]
__free_pages_ok+0x476/0xce0 mm/page_alloc.c:1572
device_release+0x9f/0x240 drivers/base/core.c:2190
kobject_cleanup lib/kobject.c:705 [inline]
kobject_release lib/kobject.c:736 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1c8/0x540 lib/kobject.c:753
put_device+0x1b/0x30 drivers/base/core.c:3432
ath9k_htc_probe_device+0x1c7/0x1e50 drivers/net/wireless/ath/ath9k/htc_drv_init.c:976
ath9k_htc_hw_init+0x31/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:503
ath9k_hif_usb_firmware_cb+0x274/0x530 drivers/net/wireless/ath/ath9k/hif_usb.c:1239
request_firmware_work_func+0x12c/0x230 drivers/base/firmware_loader/main.c:1081
process_one_work+0x98d/0x1600 kernel/workqueue.c:2276
worker_thread+0x64c/0x1120 kernel/workqueue.c:2422
kthread+0x3b1/0x4a0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Memory state around the buggy address:
ffff888036db4000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888036db4080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888036db4100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff888036db4180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888036db4200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

syzbot

unread,
Jun 14, 2021, 2:51:06 PM6/14/21
to chouhan.sh...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: use-after-free Read in ath9k_hif_usb_rx_cb

==================================================================
BUG: KASAN: use-after-free in ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
BUG: KASAN: use-after-free in ath9k_hif_usb_rx_cb+0xdd8/0x1050 drivers/net/wireless/ath/ath9k/hif_usb.c:680
Read of size 4 at addr ffff88803a594178 by task kworker/1:0/20

CPU: 1 PID: 20 Comm: kworker/1:0 Not tainted 5.13.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
ath9k_hif_usb_rx_cb+0xdd8/0x1050 drivers/net/wireless/ath/ath9k/hif_usb.c:680
__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+0x11f4/0x32a0 drivers/usb/gadget/udc/dummy_hcd.c:1978
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1431
expire_timers kernel/time/timer.c:1476 [inline]
__run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1745
__run_timers kernel/time/timer.c:1726 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1758
__do_softirq+0x29b/0x9f6 kernel/softirq.c:559
invoke_softirq kernel/softirq.c:433 [inline]
__irq_exit_rcu+0x136/0x200 kernel/softirq.c:637
irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
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:647
RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:27 [inline]
RIP: 0010:check_kcov_mode kernel/kcov.c:163 [inline]
RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x60 kernel/kcov.c:197
Code: f0 4d 89 03 e9 f2 fc ff ff b9 ff ff ff ff ba 08 00 00 00 4d 8b 03 48 0f bd ca 49 8b 45 00 48 63 c9 e9 64 ff ff ff 0f 1f 40 00 <65> 8b 05 b9 15 8d 7e 89 c1 48 8b 34 24 81 e1 00 01 00 00 65 48 8b
RSP: 0018:ffffc90000da7540 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888011c38000 RSI: ffffffff815cb063 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff8fa268a7
R10: ffffffff815cb059 R11: 0000000000000000 R12: ffffffff84bbcfa0
R13: 0000000000000200 R14: dffffc0000000000 R15: ffffc90000da75a0
console_unlock+0x7c9/0xc40 kernel/printk/printk.c:2653
vprintk_emit+0x1ca/0x560 kernel/printk/printk.c:2174
dev_vprintk_emit+0x36e/0x3b2 drivers/base/core.c:4525
dev_printk_emit+0xba/0xf1 drivers/base/core.c:4536
__dev_printk+0xcf/0xf5 drivers/base/core.c:4548
_dev_info+0xd7/0x109 drivers/base/core.c:4594
show_string drivers/usb/core/hub.c:2270 [inline]
announce_device drivers/usb/core/hub.c:2287 [inline]
usb_new_device.cold+0x905/0x1058 drivers/usb/core/hub.c:2536
hub_port_connect drivers/usb/core/hub.c:5276 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5416 [inline]
port_event drivers/usb/core/hub.c:5562 [inline]
hub_event+0x2357/0x4330 drivers/usb/core/hub.c:5644
process_one_work+0x98d/0x1600 kernel/workqueue.c:2276
worker_thread+0x64c/0x1120 kernel/workqueue.c:2422
kthread+0x3b1/0x4a0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 4843:
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:428 [inline]
____kasan_kmalloc mm/kasan/common.c:507 [inline]
____kasan_kmalloc mm/kasan/common.c:466 [inline]
__kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516
kmalloc include/linux/slab.h:561 [inline]
tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
security_inode_getattr+0xcf/0x140 security/security.c:1332
vfs_getattr fs/stat.c:139 [inline]
vfs_statx+0x164/0x390 fs/stat.c:207
vfs_fstatat fs/stat.c:225 [inline]
vfs_lstat include/linux/fs.h:3384 [inline]
__do_sys_newlstat+0x91/0x110 fs/stat.c:380
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 4843:
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:357
____kasan_slab_free mm/kasan/common.c:360 [inline]
____kasan_slab_free mm/kasan/common.c:325 [inline]
__kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368
kasan_slab_free include/linux/kasan.h:212 [inline]
slab_free_hook mm/slub.c:1582 [inline]
slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1607
slab_free mm/slub.c:3167 [inline]
kfree+0xe5/0x7f0 mm/slub.c:4217
tomoyo_realpath_from_path+0x191/0x620 security/tomoyo/realpath.c:291
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
security_inode_getattr+0xcf/0x140 security/security.c:1332
vfs_getattr fs/stat.c:139 [inline]
vfs_statx+0x164/0x390 fs/stat.c:207
vfs_fstatat fs/stat.c:225 [inline]
vfs_lstat include/linux/fs.h:3384 [inline]
__do_sys_newlstat+0x91/0x110 fs/stat.c:380
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88803a594000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 376 bytes inside of
4096-byte region [ffff88803a594000, ffff88803a595000)
The buggy address belongs to the page:
page:ffffea0000e96400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3a590
head:ffffea0000e96400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010842140
raw: 0000000000000000 0000000000040004 00000001ffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4843, ts 111423075982, free_ts 111415998555
prep_new_page mm/page_alloc.c:2358 [inline]
get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200
alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
alloc_slab_page mm/slub.c:1645 [inline]
allocate_slab+0x2c5/0x4c0 mm/slub.c:1785
new_slab mm/slub.c:1848 [inline]
new_slab_objects mm/slub.c:2594 [inline]
___slab_alloc+0x4a1/0x810 mm/slub.c:2757
__slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2797
slab_alloc_node mm/slub.c:2879 [inline]
slab_alloc mm/slub.c:2921 [inline]
kmem_cache_alloc_trace+0x2a3/0x2c0 mm/slub.c:2938
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:686 [inline]
kernfs_iop_get_link fs/kernfs/symlink.c:135 [inline]
kernfs_iop_get_link+0x61/0x6e0 fs/kernfs/symlink.c:126
vfs_readlink+0x1d7/0x390 fs/namei.c:4795
do_readlinkat+0x27e/0x2f0 fs/stat.c:437
__do_sys_readlinkat fs/stat.c:452 [inline]
__se_sys_readlinkat fs/stat.c:449 [inline]
__x64_sys_readlinkat+0x93/0xf0 fs/stat.c:449
do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1298 [inline]
__free_pages_ok+0x476/0xce0 mm/page_alloc.c:1572
device_release+0x9f/0x240 drivers/base/core.c:2190
kobject_cleanup lib/kobject.c:705 [inline]
kobject_release lib/kobject.c:736 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x1c8/0x540 lib/kobject.c:753
put_device+0x1b/0x30 drivers/base/core.c:3432
ath9k_htc_probe_device+0x1c7/0x1e50 drivers/net/wireless/ath/ath9k/htc_drv_init.c:976
ath9k_htc_hw_init+0x31/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:503
ath9k_hif_usb_firmware_cb+0x274/0x530 drivers/net/wireless/ath/ath9k/hif_usb.c:1239
request_firmware_work_func+0x12c/0x230 drivers/base/firmware_loader/main.c:1081
process_one_work+0x98d/0x1600 kernel/workqueue.c:2276
worker_thread+0x64c/0x1120 kernel/workqueue.c:2422
kthread+0x3b1/0x4a0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Memory state around the buggy address:
ffff88803a594000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88803a594080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88803a594100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88803a594180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88803a594200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


Tested on:

commit: 009c9aa5 Linux 5.13-rc6
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11261bebd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=3df058fc9d413abe

syzbot

unread,
Mar 15, 2022, 5:36:12 AM3/15/22
to andre...@google.com, ath9k...@qca.qualcomm.com, chouhan.sh...@gmail.com, da...@davemloft.net, ku...@kernel.org, kv...@codeaurora.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, linux-w...@vger.kernel.org, masa...@kernel.org, micha...@markovi.net, ndesau...@google.com, net...@vger.kernel.org, syzkall...@googlegroups.com, torv...@linux-foundation.org
syzbot suspects this issue was fixed by commit:

commit 09688c0166e76ce2fb85e86b9d99be8b0084cdf9
Author: Linus Torvalds <torv...@linux-foundation.org>
Date: Sun Mar 13 20:23:37 2022 +0000

Linux 5.17-rc8

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=140283ad700000
start commit: f5b6eb1e0182 Merge branch 'i2c/for-current' of git://git.k..
git tree: upstream
If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: Linux 5.17-rc8

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Linus Torvalds

unread,
Mar 15, 2022, 1:08:55 PM3/15/22
to syzbot, Andrey Konovalov, ath9k...@qca.qualcomm.com, chouhan.sh...@gmail.com, David Miller, Jakub Kicinski, Kalle Valo, Linux Kbuild mailing list, Linux Kernel Mailing List, open list:USB GADGET/PERIPHERAL SUBSYSTEM, linux-wireless, Masahiro Yamada, Michal Marek, Nick Desaulniers, Netdev, syzkaller-bugs
On Tue, Mar 15, 2022 at 2:36 AM syzbot
<syzbot+3f1ca6...@syzkaller.appspotmail.com> wrote:
>
> syzbot suspects this issue was fixed by commit
> 09688c0166e7 ("Linux 5.17-rc8")

No, I'm afraid that means that the bisection is broken:

> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=140283ad700000

and yeah, looking at that log it looks like every single run has

testing commit [...]
run #0: crashed: KASAN: use-after-free Read in ath9k_hif_usb_rx_cb
...
# git bisect good [...]

and you never saw a "bad" commit that didn't have the issue, so the
top-of-tree gets marked "good" (and I suspect you intentionally mark
the broken case "good" in order to find where it got fixed, so you're
using "git bisect" in a reverse way).

I didn't look closer, but it does seem to not reproduce very reliably,
maybe that is what confused the bot originally.

Linus

Dmitry Vyukov

unread,
Mar 16, 2022, 3:45:40 AM3/16/22
to Linus Torvalds, syzbot, Andrey Konovalov, ath9k...@qca.qualcomm.com, chouhan.sh...@gmail.com, David Miller, Jakub Kicinski, Kalle Valo, Linux Kbuild mailing list, Linux Kernel Mailing List, open list:USB GADGET/PERIPHERAL SUBSYSTEM, linux-wireless, Masahiro Yamada, Michal Marek, Nick Desaulniers, Netdev, syzkaller-bugs, Zekun Shen
Hi Linus,

Thanks for taking a look. Yes, it's a "reverse" bisection that tries
to find the fix.
And your conclusion re flakiness looks right, there were few runs with
only 1/20 crashes.
But the bug looks to be fixed by something anyway. git log on the file
pretty clearly points to:

#syz fix: ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream

Linus Torvalds

unread,
Mar 16, 2022, 12:01:47 PM3/16/22
to Dmitry Vyukov, syzbot, Andrey Konovalov, ath9k...@qca.qualcomm.com, chouhan.sh...@gmail.com, David Miller, Jakub Kicinski, Kalle Valo, Linux Kbuild mailing list, Linux Kernel Mailing List, open list:USB GADGET/PERIPHERAL SUBSYSTEM, linux-wireless, Masahiro Yamada, Michal Marek, Nick Desaulniers, Netdev, syzkaller-bugs, Zekun Shen
On Wed, Mar 16, 2022 at 12:45 AM Dmitry Vyukov <dvy...@google.com> wrote:
>
> But the bug looks to be fixed by something anyway. git log on the file
> pretty clearly points to:
>
> #syz fix: ath9k: Fix out-of-bound memcpy in ath9k_hif_usb_rx_stream

Yeah, that commit 6ce708f54cc8 looks a lot more likely to have any
effect on this than my version bump that the syzbot bisection pointed
to.

But kernels containing that commit still have that

run #0: crashed: KASAN: use-after-free Read in ath9k_hif_usb_rx_cb

so apparently it isn't actually fully fixed. ;(

Linus

Hillf Danton

unread,
Mar 17, 2022, 7:11:39 AM3/17/22
to syzbot, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, syzkall...@googlegroups.com
On Sun, 06 Jun 2021 14:16:15 -0700
Fix oob by adding boundary check.

Hillf

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

--- x/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ y/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -633,6 +633,10 @@ static void ath9k_hif_usb_rx_stream(stru
"ath9k_htc: over RX MAX_PKT_NUM\n");
goto err;
}
+ if (pkt_len >= len || len - pkt_len < chk_idx + 4) {
+ dev_err(&hif_dev->udev->dev, "ath9k_htc: RX OOB\n");
+ goto err;
+ }
nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
if (!nskb) {
dev_err(&hif_dev->udev->dev,
--

syzbot

unread,
Mar 17, 2022, 7:11:42 AM3/17/22
to Hillf Danton, hda...@sina.com, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, syzkall...@googlegroups.com
This bug is already marked as fixed. No point in testing.
Reply all
Reply to author
Forward
0 new messages