All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 215405] New: use-after-free Read in ath9k_hif_usb_rx_cb' bug
Date: Sat, 25 Dec 2021 04:21:05 +0000	[thread overview]
Message-ID: <bug-215405-208809@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=215405

            Bug ID: 215405
           Summary: use-after-free Read in ath9k_hif_usb_rx_cb' bug
           Product: Drivers
           Version: 2.5
    Kernel Version: linux-5.16-rc6
          Hardware: x86-64
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: USB
          Assignee: drivers_usb@kernel-bugs.kernel.org
          Reporter: 6201613047@stu.jiangnan.edu.cn
        Regression: No

Created attachment 300141
  --> https://bugzilla.kernel.org/attachment.cgi?id=300141&action=edit
poc.c

I've using Syzkaller-USB get a use-after-free BUG on the USB drivers. And the
the report is as follow.

==================================================================
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+0xeca/0x1160
drivers/net/wireless/ath/ath9k/hif_usb.c:680
Read of size 4 at addr ffff88810d524278 by task swapper/0/0

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.16.0-rc6 #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1
04/01/2014
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x93/0x347 mm/kasan/report.c:247
 __kasan_report mm/kasan/report.c:433 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:450
 ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:636 [inline]
 ath9k_hif_usb_rx_cb+0xeca/0x1160 drivers/net/wireless/ath/ath9k/hif_usb.c:680
 __usb_hcd_giveback_urb+0x2c2/0x5a0 drivers/usb/core/hcd.c:1656
 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1726
 dummy_timer+0x1267/0x33b0 drivers/usb/gadget/udc/dummy_hcd.c:1987
 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
 expire_timers kernel/time/timer.c:1466 [inline]
 __run_timers.part.0+0x6b0/0xa90 kernel/time/timer.c:1734
 __run_timers kernel/time/timer.c:1715 [inline]
 run_timer_softirq+0xb6/0x1d0 kernel/time/timer.c:1747
 __do_softirq+0x1c0/0x8ee kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu kernel/softirq.c:637 [inline]
 irq_exit_rcu+0xe2/0x120 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:default_idle+0xb/0x10 arch/x86/kernel/process.c:734
Code: bf fe ff 4c 89 e2 48 89 ef 5d 41 5c 31 f6 e9 ac 12 7a fc cc cc cc cc cc
cc cc cc cc cc cc cc eb 07 0f 00 2d 77 44 5a 00 fb f4 <c3> 0f 1f 40 00 41 54 be
08 00 00 00 53 65 48 8b 1c 25 80 6f 02 00
RSP: 0018:ffffffff87607e28 EFLAGS: 00000206
RAX: 0000000000022311 RBX: 0000000000000000 RCX: ffffffff85c676b2
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000001 R09: ffffed10235070eb
R10: ffff88811a838753 R11: ffffed10235070ea R12: 0000000000000000
R13: 0000000000000000 R14: ffffffff88b50150 R15: 0000000000000000
 default_idle_call+0xc4/0x420 kernel/sched/idle.c:112
 cpuidle_idle_call kernel/sched/idle.c:194 [inline]
 do_idle+0x3f9/0x570 kernel/sched/idle.c:306
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:403
 start_kernel+0x47a/0x49b init/main.c:1135
 secondary_startup_64_no_verify+0xb0/0xbb
 </TASK>

The buggy address belongs to the page:
page:ffffea0004354900 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
pfn:0x10d524
flags: 0x200000000000000(node=0|zone=2)
raw: 0200000000000000 0000000000000000 ffffea0004354908 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask
0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), pid 268, ts 48372046740, free_ts
49398863548
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2412 [inline]
 prep_new_page+0x1a6/0x240 mm/page_alloc.c:2418
 get_page_from_freelist+0x1612/0x28c0 mm/page_alloc.c:4149
 __alloc_pages+0x2d5/0x6c0 mm/page_alloc.c:5369
 alloc_pages+0x115/0x240 mm/mempolicy.c:2191
 kmalloc_order+0x34/0xf0 mm/slab_common.c:949
 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:965
 kmalloc_large include/linux/slab.h:519 [inline]
 __kmalloc+0x316/0x3a0 mm/slub.c:4412
 kmalloc include/linux/slab.h:595 [inline]
 kzalloc include/linux/slab.h:724 [inline]
 wiphy_new_nm+0x6f0/0x1e40 net/wireless/core.c:449
 ieee80211_alloc_hw_nm+0x38b/0x2280 net/mac80211/main.c:585
 ieee80211_alloc_hw include/net/mac80211.h:4315 [inline]
 ath9k_htc_probe_device+0x97/0x1f40
drivers/net/wireless/ath/ath9k/htc_drv_init.c:939
 ath9k_htc_hw_init+0x31/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:503
 ath9k_hif_usb_firmware_cb+0x274/0x510
drivers/net/wireless/ath/ath9k/hif_usb.c:1239
 request_firmware_work_func+0x12c/0x230
drivers/base/firmware_loader/main.c:1022
 process_one_work+0x9df/0x16d0 kernel/workqueue.c:2298
 worker_thread+0x90/0xed0 kernel/workqueue.c:2445
 kthread+0x40b/0x500 kernel/kthread.c:327
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1338 [inline]
 free_pcp_prepare+0x447/0x8c0 mm/page_alloc.c:1389
 free_unref_page_prepare mm/page_alloc.c:3309 [inline]
 free_unref_page+0x19/0x4a0 mm/page_alloc.c:3388
 free_nonslab_page mm/slub.c:3551 [inline]
 kfree+0x387/0x470 mm/slub.c:4558
 device_release+0x9f/0x240 drivers/base/core.c:2230
 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/0x530 lib/kobject.c:753
 put_device+0x1b/0x30 drivers/base/core.c:3501
 ath9k_htc_probe_device+0x1c7/0x1f40
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/0x510
drivers/net/wireless/ath/ath9k/hif_usb.c:1239
 request_firmware_work_func+0x12c/0x230
drivers/base/firmware_loader/main.c:1022
 process_one_work+0x9df/0x16d0 kernel/workqueue.c:2298
 worker_thread+0x90/0xed0 kernel/workqueue.c:2445
 kthread+0x40b/0x500 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff88810d524100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810d524180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88810d524200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                                ^
 ffff88810d524280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88810d524300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
----------------
Code disassembly (best guess):
   0:   bf fe ff 4c 89          mov    $0x894cfffe,%edi
   5:   e2 48                   loop   0x4f
   7:   89 ef                   mov    %ebp,%edi
   9:   5d                      pop    %rbp
   a:   41 5c                   pop    %r12
   c:   31 f6                   xor    %esi,%esi
   e:   e9 ac 12 7a fc          jmpq   0xfc7a12bf
  13:   cc                      int3
  14:   cc                      int3
  15:   cc                      int3
  16:   cc                      int3
  17:   cc                      int3
  18:   cc                      int3
  19:   cc                      int3
  1a:   cc                      int3
  1b:   cc                      int3
  1c:   cc                      int3
  1d:   cc                      int3
  1e:   cc                      int3
  1f:   eb 07                   jmp    0x28
  21:   0f 00 2d 77 44 5a 00    verw   0x5a4477(%rip)        # 0x5a449f
  28:   fb                      sti
  29:   f4                      hlt
* 2a:   c3                      retq <-- trapping instruction
  2b:   0f 1f 40 00             nopl   0x0(%rax)
  2f:   41 54                   push   %r12
  31:   be 08 00 00 00          mov    $0x8,%esi
  36:   53                      push   %rbx
  37:   65 48 8b 1c 25 80 6f    mov    %gs:0x26f80,%rbx
  3e:   02 00

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

                 reply	other threads:[~2021-12-25  4:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-215405-208809@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.