* [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
@ 2024-04-22 6:47 syzbot
2024-06-19 11:23 ` syzbot
0 siblings, 1 reply; 17+ messages in thread
From: syzbot @ 2024-04-22 6:47 UTC (permalink / raw)
To: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: dbe0a7be2838 Merge tag 'thermal-6.9-rc5' of git://git.kern..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1797a520980000
kernel config: https://syzkaller.appspot.com/x/.config?x=c5d33c579b4e833f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/533abb2e04bb/disk-dbe0a7be.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bab25bf1664b/vmlinux-dbe0a7be.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a86e1d3d98aa/bzImage-dbe0a7be.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: double-free in kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1159
Free of addr ffff8880114bcdc0 by task kworker/u9:0/52
CPU: 1 PID: 52 Comm: kworker/u9:0 Not tainted 6.9.0-rc4-syzkaller-00164-gdbe0a7be2838 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci4 hci_rx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report_invalid_free+0xaa/0xd0 mm/kasan/report.c:563
poison_slab_object mm/kasan/common.c:232 [inline]
__kasan_slab_free+0x16b/0x1a0 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2106 [inline]
slab_free mm/slub.c:4280 [inline]
kmem_cache_free+0x12e/0x380 mm/slub.c:4344
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1159
__kfree_skb net/core/skbuff.c:1217 [inline]
kfree_skb_reason+0x13a/0x210 net/core/skbuff.c:1252
kfree_skb include/linux/skbuff.h:1262 [inline]
hci_req_sync_complete+0x16c/0x270 net/bluetooth/hci_request.c:109
hci_event_packet+0x966/0x1170 net/bluetooth/hci_event.c:7604
hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4171
process_one_work+0x9ac/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c4/0x3a0 kernel/kthread.c:388
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Allocated by task 52:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3798 [inline]
slab_alloc_node mm/slub.c:3845 [inline]
kmem_cache_alloc+0x136/0x320 mm/slub.c:3852
skb_clone+0x190/0x3f0 net/core/skbuff.c:2063
hci_send_cmd_sync net/bluetooth/hci_core.c:4220 [inline]
hci_cmd_work+0x66a/0x710 net/bluetooth/hci_core.c:4240
process_one_work+0x9ac/0x1ac0 kernel/workqueue.c:3254
process_scheduled_works kernel/workqueue.c:3335 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416
kthread+0x2c4/0x3a0 kernel/kthread.c:388
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Freed by task 10076:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:240 [inline]
__kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2106 [inline]
slab_free mm/slub.c:4280 [inline]
kmem_cache_free+0x12e/0x380 mm/slub.c:4344
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1159
__kfree_skb net/core/skbuff.c:1217 [inline]
kfree_skb_reason+0x13a/0x210 net/core/skbuff.c:1252
kfree_skb include/linux/skbuff.h:1262 [inline]
__hci_req_sync+0x61d/0x980 net/bluetooth/hci_request.c:184
hci_req_sync+0x97/0xd0 net/bluetooth/hci_request.c:206
hci_dev_cmd+0x653/0x9c0 net/bluetooth/hci_core.c:790
hci_sock_ioctl+0x4f3/0x8e0 net/bluetooth/hci_sock.c:1153
sock_do_ioctl+0x119/0x280 net/socket.c:1222
sock_ioctl+0x22e/0x6c0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:904 [inline]
__se_sys_ioctl fs/ioctl.c:890 [inline]
__x64_sys_ioctl+0x196/0x220 fs/ioctl.c:890
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff8880114bcdc0
which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 0 bytes inside of
240-byte region [ffff8880114bcdc0, ffff8880114bceb0)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x114bc
flags: 0xfff80000000800(slab|node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000800 ffff888018ad6780 ffffea000183fd00 dead000000000002
raw: 0000000000000000 00000000800c000c 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 4748, tgid 666454001 (dhcpcd), ts 4748, free_ts 597626032748
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534
prep_new_page mm/page_alloc.c:1541 [inline]
get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317
__alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page mm/slub.c:2175 [inline]
allocate_slab mm/slub.c:2338 [inline]
new_slab+0xcc/0x3a0 mm/slub.c:2391
___slab_alloc+0x66d/0x1790 mm/slub.c:3525
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610
__slab_alloc_node mm/slub.c:3663 [inline]
slab_alloc_node mm/slub.c:3835 [inline]
kmem_cache_alloc_node+0x10a/0x340 mm/slub.c:3888
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:658
alloc_skb include/linux/skbuff.h:1313 [inline]
alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6504
sock_alloc_send_pskb+0x7f1/0x980 net/core/sock.c:2795
unix_dgram_sendmsg+0x4b9/0x1b10 net/unix/af_unix.c:2019
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
sock_write_iter+0x50d/0x5c0 net/socket.c:1160
call_write_iter include/linux/fs.h:2110 [inline]
do_iter_readv_writev+0x507/0x780 fs/read_write.c:741
vfs_writev+0x36f/0xdb0 fs/read_write.c:971
do_writev+0x287/0x370 fs/read_write.c:1018
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83
page last free pid 8963 tgid 8961 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1141 [inline]
free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347
free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487
tlb_batch_list_free mm/mmu_gather.c:159 [inline]
tlb_finish_mmu+0x237/0x7b0 mm/mmu_gather.c:468
exit_mmap+0x3da/0xb90 mm/mmap.c:3280
__mmput+0x12a/0x4d0 kernel/fork.c:1346
mmput+0x62/0x70 kernel/fork.c:1368
exit_mm kernel/exit.c:569 [inline]
do_exit+0x999/0x2c10 kernel/exit.c:865
do_group_exit+0xd3/0x2a0 kernel/exit.c:1027
get_signal+0x2616/0x2710 kernel/signal.c:2911
arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:310
exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x14a/0x2a0 kernel/entry/common.c:218
do_syscall_64+0xdc/0x260 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff8880114bcc80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880114bcd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
>ffff8880114bcd80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff8880114bce00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880114bce80: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
==================================================================
---
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 syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-04-22 6:47 [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete syzbot
@ 2024-06-19 11:23 ` syzbot
2024-06-19 12:32 ` Edward Adam Davis
` (7 more replies)
0 siblings, 8 replies; 17+ messages in thread
From: syzbot @ 2024-06-19 11:23 UTC (permalink / raw)
To: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel,
syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: 2ccbdf43d5e7 Merge tag 'for-linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10d61bca980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125874ea980000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-2ccbdf43.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c40c1cd990d2/vmlinux-2ccbdf43.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a2a94050804e/bzImage-2ccbdf43.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: double-free in kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1131
Free of addr ffff888025dce280 by task kworker/u33:6/5317
CPU: 2 PID: 5317 Comm: kworker/u33:6 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: hci0 hci_rx_work
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report_invalid_free+0xaa/0xd0 mm/kasan/report.c:563
poison_slab_object+0x135/0x160 mm/kasan/common.c:232
__kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2196 [inline]
slab_free mm/slub.c:4437 [inline]
kmem_cache_free+0x12f/0x3a0 mm/slub.c:4512
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1131
__kfree_skb net/core/skbuff.c:1188 [inline]
kfree_skb_reason+0x138/0x210 net/core/skbuff.c:1223
kfree_skb include/linux/skbuff.h:1257 [inline]
hci_req_sync_complete+0x16c/0x270 net/bluetooth/hci_request.c:109
hci_event_packet+0x963/0x1170 net/bluetooth/hci_event.c:7479
hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4074
process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Allocated by task 5317:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3941 [inline]
slab_alloc_node mm/slub.c:4001 [inline]
kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4008
skb_clone+0x190/0x3f0 net/core/skbuff.c:2052
hci_send_cmd_sync net/bluetooth/hci_core.c:4123 [inline]
hci_cmd_work+0x66a/0x710 net/bluetooth/hci_core.c:4143
process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
Freed by task 5306:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
__kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2196 [inline]
slab_free mm/slub.c:4437 [inline]
kmem_cache_free+0x12f/0x3a0 mm/slub.c:4512
kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1131
__kfree_skb net/core/skbuff.c:1188 [inline]
kfree_skb_reason+0x138/0x210 net/core/skbuff.c:1223
kfree_skb include/linux/skbuff.h:1257 [inline]
__hci_req_sync+0x61d/0x980 net/bluetooth/hci_request.c:184
hci_req_sync+0x97/0xd0 net/bluetooth/hci_request.c:206
hci_dev_cmd+0x634/0x960 net/bluetooth/hci_core.c:787
hci_sock_ioctl+0x4f3/0x880 net/bluetooth/hci_sock.c:1150
sock_do_ioctl+0x116/0x280 net/socket.c:1222
sock_ioctl+0x22e/0x6c0 net/socket.c:1341
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl fs/ioctl.c:893 [inline]
__x64_sys_ioctl+0x193/0x220 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888025dce280
which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 0 bytes inside of
240-byte region [ffff888025dce280, ffff888025dce370)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25dce
head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000040 ffff888018ed8780 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080190019 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff888018ed8780 dead000000000122 0000000000000000
head: 0000000000000000 0000000080190019 00000001ffffefff 0000000000000000
head: 00fff00000000001 ffffea0000977381 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5306, tgid 5306 (syz-executor.3), ts 70131626595, free_ts 69503653671
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468
prep_new_page mm/page_alloc.c:1476 [inline]
get_page_from_freelist+0x136a/0x2e50 mm/page_alloc.c:3420
__alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4678
__alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
alloc_slab_page+0x56/0x110 mm/slub.c:2265
allocate_slab mm/slub.c:2428 [inline]
new_slab+0x84/0x260 mm/slub.c:2481
___slab_alloc+0xdac/0x1870 mm/slub.c:3667
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
__slab_alloc_node mm/slub.c:3810 [inline]
slab_alloc_node mm/slub.c:3989 [inline]
kmem_cache_alloc_node_noprof+0xed/0x310 mm/slub.c:4044
__alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
alloc_skb include/linux/skbuff.h:1308 [inline]
bt_skb_alloc include/net/bluetooth/bluetooth.h:489 [inline]
hci_prepare_cmd+0x32/0x2b0 net/bluetooth/hci_request.c:221
hci_req_add_ev+0x11b/0x2b0 net/bluetooth/hci_request.c:255
hci_scan_req+0x87/0x150 net/bluetooth/hci_core.c:73
__hci_req_sync+0x142/0x980 net/bluetooth/hci_request.c:130
hci_req_sync+0x97/0xd0 net/bluetooth/hci_request.c:206
hci_dev_cmd+0x634/0x960 net/bluetooth/hci_core.c:787
hci_sock_ioctl+0x4f3/0x880 net/bluetooth/hci_sock.c:1150
page last free pid 4688 tgid 4688 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1088 [inline]
free_unref_page+0x64a/0xe40 mm/page_alloc.c:2583
__put_partials+0x14c/0x170 mm/slub.c:2995
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3941 [inline]
slab_alloc_node mm/slub.c:4001 [inline]
kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4008
getname_flags.part.0+0x50/0x4f0 fs/namei.c:139
getname_flags+0x9b/0xf0 include/linux/audit.h:322
vfs_fstatat+0x9a/0x150 fs/stat.c:303
__do_sys_newfstatat+0xa6/0x130 fs/stat.c:468
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888025dce180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888025dce200: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
>ffff888025dce280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888025dce300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
ffff888025dce380: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================
---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
@ 2024-06-19 12:32 ` Edward Adam Davis
2024-06-19 12:58 ` syzbot
2024-06-23 2:36 ` Edward Adam Davis
` (6 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-19 12:32 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae; +Cc: linux-kernel, syzkaller-bugs
please test db free in hci_req_sync_complete
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..ac27ea24844c 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,7 +106,8 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
if (skb) {
- kfree_skb(hdev->req_skb);
+ if (skb != hdev->req_skb)
+ kfree_skb(hdev->req_skb);
hdev->req_skb = skb_get(skb);
}
wake_up_interruptible(&hdev->req_wait_q);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 12:32 ` Edward Adam Davis
@ 2024-06-19 12:58 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-19 12:58 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16b60a61980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11174ada980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
2024-06-19 12:32 ` Edward Adam Davis
@ 2024-06-23 2:36 ` Edward Adam Davis
2024-06-23 3:08 ` syzbot
2024-06-23 3:42 ` Edward Adam Davis
` (5 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-23 2:36 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae; +Cc: linux-kernel, syzkaller-bugs
please test db free in hci_req_sync_complete
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..60a8968bf854 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,7 +106,9 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
if (skb) {
- kfree_skb(hdev->req_skb);
+ printk("skb: %p, skb fc: %d, rskb: %p, rskb fc: %d, %s\n", skb, skb->fclone, hdev->req_skb, hdev->req_skb->fclone, __func__);
+ if (hdev->req_skb->fclone == SKB_FCLONE_CLONE)
+ kfree_skb(hdev->req_skb);
hdev->req_skb = skb_get(skb);
}
wake_up_interruptible(&hdev->req_wait_q);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-23 2:36 ` Edward Adam Davis
@ 2024-06-23 3:08 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-23 3:08 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
general protection fault in hci_req_sync_complete
skb: ffff88802ca99900, skb fc: 0, rskb: ffff88802ca99540, rskb fc: 0, hci_req_sync_complete
Oops: general protection fault, probably for non-canonical address 0xdffffc000000000f: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000078-0x000000000000007f]
CPU: 0 PID: 65 Comm: kworker/u33:0 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7-dirty #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: hci2 hci_rx_work
RIP: 0010:hci_req_sync_complete+0x217/0x3d0 net/bluetooth/hci_request.c:110
Code: 48 c1 ea 03 80 3c 02 00 0f 85 76 01 00 00 4c 8b b3 08 0e 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d 7e 7e 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 3a 01 00 00
RSP: 0018:ffffc90000d27b10 EFLAGS: 00010207
RAX: dffffc0000000000 RBX: ffff88801edac000 RCX: ffffffff816e69b9
RDX: 000000000000000f RSI: ffffffff816ef706 RDI: 000000000000007e
RBP: ffff88802ca99900 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000005 R12: 0000000000000000
R13: ffff88801edace08 R14: 0000000000000000 R15: 0000000000000c1a
FS: 0000000000000000(0000) GS:ffff88806b000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f599deb91b0 CR3: 000000002af2e000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
hci_event_packet+0x963/0x1170 net/bluetooth/hci_event.c:7479
hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4074
process_one_work+0x9fb/0x1b60 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:hci_req_sync_complete+0x217/0x3d0 net/bluetooth/hci_request.c:110
Code: 48 c1 ea 03 80 3c 02 00 0f 85 76 01 00 00 4c 8b b3 08 0e 00 00 48 b8 00 00 00 00 00 fc ff df 49 8d 7e 7e 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 3a 01 00 00
RSP: 0018:ffffc90000d27b10 EFLAGS: 00010207
RAX: dffffc0000000000 RBX: ffff88801edac000 RCX: ffffffff816e69b9
RDX: 000000000000000f RSI: ffffffff816ef706 RDI: 000000000000007e
RBP: ffff88802ca99900 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000005 R12: 0000000000000000
R13: ffff88801edace08 R14: 0000000000000000 R15: 0000000000000c1a
FS: 0000000000000000(0000) GS:ffff88806b000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f599deb91b0 CR3: 000000001a976000 CR4: 0000000000350ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 48 c1 ea 03 shr $0x3,%rdx
4: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1)
8: 0f 85 76 01 00 00 jne 0x184
e: 4c 8b b3 08 0e 00 00 mov 0xe08(%rbx),%r14
15: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1c: fc ff df
1f: 49 8d 7e 7e lea 0x7e(%r14),%rdi
23: 48 89 fa mov %rdi,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax <-- trapping instruction
2e: 48 89 fa mov %rdi,%rdx
31: 83 e2 07 and $0x7,%edx
34: 38 d0 cmp %dl,%al
36: 7f 08 jg 0x40
38: 84 c0 test %al,%al
3a: 0f 85 3a 01 00 00 jne 0x17a
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=137c4c8e980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=11d3c1fa980000
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
2024-06-19 12:32 ` Edward Adam Davis
2024-06-23 2:36 ` Edward Adam Davis
@ 2024-06-23 3:42 ` Edward Adam Davis
2024-06-23 4:06 ` syzbot
2024-06-23 4:14 ` Edward Adam Davis
` (4 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-23 3:42 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae; +Cc: linux-kernel, syzkaller-bugs
please test db free in hci_req_sync_complete
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..c98d573eae87 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,7 +106,13 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
if (skb) {
- kfree_skb(hdev->req_skb);
+ if (!hdev->req_skb)
+ printk("skb: %p, fclone: %d %s\n", skb, skb->fclone, __func__);
+
+ if (hdev->req_skb && hdev->req_skb->fclone == SKB_FCLONE_CLONE) {
+ printk("skb: %p, skb fc: %d, rskb: %p, rskb fc: %d, %s\n", skb, skb->fclone, hdev->req_skb, hdev->req_skb->fclone, __func__);
+ kfree_skb(hdev->req_skb);
+ }
hdev->req_skb = skb_get(skb);
}
wake_up_interruptible(&hdev->req_wait_q);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-23 3:42 ` Edward Adam Davis
@ 2024-06-23 4:06 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-23 4:06 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=156b6346980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=16f4a161980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
` (2 preceding siblings ...)
2024-06-23 3:42 ` Edward Adam Davis
@ 2024-06-23 4:14 ` Edward Adam Davis
2024-06-23 4:40 ` syzbot
2024-06-23 5:43 ` Hillf Danton
` (3 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-23 4:14 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae; +Cc: linux-kernel, syzkaller-bugs
please test db free in hci_req_sync_complete
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..3862fa6bb288 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,7 +106,8 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
if (skb) {
- kfree_skb(hdev->req_skb);
+ if (hdev->req_skb)
+ kfree_skb(hdev->req_skb);
hdev->req_skb = skb_get(skb);
}
wake_up_interruptible(&hdev->req_wait_q);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-23 4:14 ` Edward Adam Davis
@ 2024-06-23 4:40 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-23 4:40 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=17dabd46980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1126b551980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
` (3 preceding siblings ...)
2024-06-23 4:14 ` Edward Adam Davis
@ 2024-06-23 5:43 ` Hillf Danton
2024-06-23 6:08 ` syzbot
2024-06-23 9:06 ` [PATCH] Bluetooth: fix double free " Edward Adam Davis
` (2 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Hillf Danton @ 2024-06-23 5:43 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Wed, 19 Jun 2024 04:23:24 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2ccbdf43d5e7 Merge tag 'for-linus' of git://git.kernel.org..
> git tree: upstream
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125874ea980000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
--- x/net/bluetooth/hci_request.c
+++ h/net/bluetooth/hci_request.c
@@ -181,7 +181,6 @@ int __hci_req_sync(struct hci_dev *hdev,
break;
}
- kfree_skb(hdev->req_skb);
hdev->req_skb = NULL;
hdev->req_status = hdev->req_result = 0;
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-23 5:43 ` Hillf Danton
@ 2024-06-23 6:08 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-23 6:08 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=15810b46980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=178fb071980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] Bluetooth: fix double free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
` (4 preceding siblings ...)
2024-06-23 5:43 ` Hillf Danton
@ 2024-06-23 9:06 ` Edward Adam Davis
2024-06-24 10:40 ` [syzbot] [bluetooth?] KASAN: invalid-free " Hillf Danton
2024-06-24 12:07 ` Edward Adam Davis
7 siblings, 0 replies; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-23 9:06 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae
Cc: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel,
syzkaller-bugs
Look at the following situation:
cpu1 cpu2
==== ====
sock_ioctl
sock_do_ioctl
hci_sock_ioctl
hci_rx_work hci_dev_cmd
hci_event_packet hci_req_sync
req_complete_skb __hci_req_sync
hci_req_sync_complete
If hci_rx_work executes before __hci_req_sync releases req_skb, everything
is normal, otherwise it will result in double free of req_skb.
Adding NULL check of req_skb before releasing it can avoid double free.
Fixes: 45d355a926ab ("Bluetooth: Fix memory leak in hci_req_sync_complete()")
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
net/bluetooth/hci_request.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..3862fa6bb288 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,7 +106,8 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
if (skb) {
- kfree_skb(hdev->req_skb);
+ if (hdev->req_skb)
+ kfree_skb(hdev->req_skb);
hdev->req_skb = skb_get(skb);
}
wake_up_interruptible(&hdev->req_wait_q);
--
2.43.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
` (5 preceding siblings ...)
2024-06-23 9:06 ` [PATCH] Bluetooth: fix double free " Edward Adam Davis
@ 2024-06-24 10:40 ` Hillf Danton
2024-06-24 11:03 ` syzbot
2024-06-24 12:07 ` Edward Adam Davis
7 siblings, 1 reply; 17+ messages in thread
From: Hillf Danton @ 2024-06-24 10:40 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Wed, 19 Jun 2024 04:23:24 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2ccbdf43d5e7 Merge tag 'for-linus' of git://git.kernel.org..
> git tree: upstream
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=125874ea980000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
--- x/net/bluetooth/hci_request.c
+++ h/net/bluetooth/hci_request.c
@@ -160,6 +160,8 @@ int __hci_req_sync(struct hci_dev *hdev,
if (err == -ERESTARTSYS)
return -EINTR;
+ if (!err)
+ return -ETIMEDOUT;
switch (hdev->req_status) {
case HCI_REQ_DONE:
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-24 10:40 ` [syzbot] [bluetooth?] KASAN: invalid-free " Hillf Danton
@ 2024-06-24 11:03 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-24 11:03 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12cc99a6980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1347808e980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-19 11:23 ` syzbot
` (6 preceding siblings ...)
2024-06-24 10:40 ` [syzbot] [bluetooth?] KASAN: invalid-free " Hillf Danton
@ 2024-06-24 12:07 ` Edward Adam Davis
2024-06-24 12:36 ` syzbot
7 siblings, 1 reply; 17+ messages in thread
From: Edward Adam Davis @ 2024-06-24 12:07 UTC (permalink / raw)
To: syzbot+35ebc808442df6420eae; +Cc: linux-kernel, syzkaller-bugs
please test db free in hci_req_sync_complete
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2ccbdf43d5e7
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 3862fa6bb288..4d5807fff946 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -121,6 +121,7 @@ int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
{
struct hci_request req;
int err = 0;
+ struct sk_buff *req_skb;
bt_dev_dbg(hdev, "start");
@@ -182,8 +183,9 @@ int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
break;
}
- kfree_skb(hdev->req_skb);
+ req_skb = hdev->req_skb;
hdev->req_skb = NULL;
+ kfree_skb(req_skb);
hdev->req_status = hdev->req_result = 0;
bt_dev_dbg(hdev, "end: err %d", err);
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete
2024-06-24 12:07 ` Edward Adam Davis
@ 2024-06-24 12:36 ` syzbot
0 siblings, 0 replies; 17+ messages in thread
From: syzbot @ 2024-06-24 12:36 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+35ebc808442df6420eae@syzkaller.appspotmail.com
Tested on:
commit: 2ccbdf43 Merge tag 'for-linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=165c91b6980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8786f381e62940f
dashboard link: https://syzkaller.appspot.com/bug?extid=35ebc808442df6420eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=12d47071980000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-06-24 12:36 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-22 6:47 [syzbot] [bluetooth?] KASAN: invalid-free in hci_req_sync_complete syzbot
2024-06-19 11:23 ` syzbot
2024-06-19 12:32 ` Edward Adam Davis
2024-06-19 12:58 ` syzbot
2024-06-23 2:36 ` Edward Adam Davis
2024-06-23 3:08 ` syzbot
2024-06-23 3:42 ` Edward Adam Davis
2024-06-23 4:06 ` syzbot
2024-06-23 4:14 ` Edward Adam Davis
2024-06-23 4:40 ` syzbot
2024-06-23 5:43 ` Hillf Danton
2024-06-23 6:08 ` syzbot
2024-06-23 9:06 ` [PATCH] Bluetooth: fix double free " Edward Adam Davis
2024-06-24 10:40 ` [syzbot] [bluetooth?] KASAN: invalid-free " Hillf Danton
2024-06-24 11:03 ` syzbot
2024-06-24 12:07 ` Edward Adam Davis
2024-06-24 12:36 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox