[v5.15] KASAN: use-after-free Read in l2cap_sock_ready_cb (3)

0 views
Skip to first unread message

syzbot

unread,
7:52 AM (15 hours ago) 7:52 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 29e53a5b1c4f Linux 5.15.194
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=100ffb34580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=0ff849c88f9974134ab2
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8cd4e3ff852c/disk-29e53a5b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/21e1f773622c/vmlinux-29e53a5b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8f418c0a25cc/bzImage-29e53a5b.xz

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

kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
</TASK>
kobject_add_internal failed for hci4:201 with -EEXIST, don't try to register things with the same name in the same directory.
Bluetooth: hci4: failed to register connection device
==================================================================
BUG: KASAN: use-after-free in l2cap_sock_ready_cb+0xca/0x120 net/bluetooth/l2cap_sock.c:1662
Read of size 8 at addr ffff888016a484c8 by task kworker/u5:7/4197

CPU: 1 PID: 4197 Comm: kworker/u5:7 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: hci4 hci_rx_work
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
print_address_description+0x60/0x2d0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0xdf/0x130 mm/kasan/report.c:451
l2cap_sock_ready_cb+0xca/0x120 net/bluetooth/l2cap_sock.c:1662
l2cap_chan_ready net/bluetooth/l2cap_core.c:1386 [inline]
l2cap_le_start+0x6c0/0x16a0 net/bluetooth/l2cap_core.c:1498
l2cap_conn_ready net/bluetooth/l2cap_core.c:1768 [inline]
l2cap_connect_cfm+0x6d7/0x10d0 net/bluetooth/l2cap_core.c:8320
hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline]
le_conn_complete_evt+0xdaf/0x1590 net/bluetooth/hci_event.c:5439
hci_le_conn_complete_evt net/bluetooth/hci_event.c:5464 [inline]
hci_le_meta_evt+0x289/0x3b80 net/bluetooth/hci_event.c:6186
hci_event_packet+0xe05/0x12f0 net/bluetooth/hci_event.c:6535
hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
</TASK>

Allocated by task 4669:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
__kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
kmalloc include/linux/slab.h:609 [inline]
sk_prot_alloc+0xe7/0x210 net/core/sock.c:1866
sk_alloc+0x2f/0x310 net/core/sock.c:1922
l2cap_sock_alloc+0x33/0x200 net/bluetooth/l2cap_sock.c:1867
l2cap_sock_create+0x118/0x1d0 net/bluetooth/l2cap_sock.c:1915
bt_sock_create+0x155/0x220 net/bluetooth/af_bluetooth.c:130
__sock_create+0x47b/0x900 net/socket.c:1486
sock_create net/socket.c:1542 [inline]
__sys_socket+0xe2/0x170 net/socket.c:1584
__do_sys_socket net/socket.c:1593 [inline]
__se_sys_socket net/socket.c:1591 [inline]
__x64_sys_socket+0x76/0x80 net/socket.c:1591
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4668:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1710 [inline]
slab_free_freelist_hook+0xea/0x170 mm/slub.c:1736
slab_free mm/slub.c:3504 [inline]
kfree+0xef/0x2a0 mm/slub.c:4564
sk_prot_free net/core/sock.c:1905 [inline]
__sk_destruct+0x578/0x840 net/core/sock.c:1991
l2cap_sock_release+0x169/0x1e0 net/bluetooth/l2cap_sock.c:1432
__sock_release net/socket.c:649 [inline]
sock_close+0xd5/0x240 net/socket.c:1336
__fput+0x234/0x930 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888016a48000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1224 bytes inside of
2048-byte region [ffff888016a48000, ffff888016a48800)
The buggy address belongs to the page:
page:ffffea00005a9200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16a48
head:ffffea00005a9200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016842000
raw: 0000000000000000 0000000000080008 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 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4186, ts 67870525192, free_ts 67839001604
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
__alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
alloc_slab_page mm/slub.c:1780 [inline]
allocate_slab mm/slub.c:1917 [inline]
new_slab+0xc0/0x4b0 mm/slub.c:1980
___slab_alloc+0x81e/0xdf0 mm/slub.c:3013
__slab_alloc mm/slub.c:3100 [inline]
slab_alloc_node mm/slub.c:3191 [inline]
__kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4963
kmalloc_reserve net/core/skbuff.c:356 [inline]
pskb_expand_head+0x127/0x10f0 net/core/skbuff.c:1709
netlink_trim+0x180/0x220 net/netlink/af_netlink.c:1299
netlink_broadcast_filtered+0x7c/0x1170 net/netlink/af_netlink.c:1511
netlink_broadcast net/netlink/af_netlink.c:1556 [inline]
nlmsg_multicast include/net/netlink.h:1033 [inline]
nlmsg_notify+0xec/0x1a0 net/netlink/af_netlink.c:2550
register_netdevice+0x1370/0x16b0 net/core/dev.c:10442
register_netdev+0x37/0x50 net/core/dev.c:10521
ip6_tnl_init_net+0x234/0x2e0 net/ipv6/ip6_tunnel.c:2301
ops_init+0x357/0x600 net/core/net_namespace.c:138
setup_net+0x38d/0x9f0 net/core/net_namespace.c:333
copy_net_ns+0x348/0x5b0 net/core/net_namespace.c:503
create_new_namespaces+0x3d3/0x6f0 kernel/nsproxy.c:110
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
free_unref_page+0x94/0x280 mm/page_alloc.c:3396
qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3225 [inline]
kmem_cache_alloc_node+0x12d/0x2d0 mm/slub.c:3261
__alloc_skb+0xf4/0x750 net/core/skbuff.c:415
alloc_skb include/linux/skbuff.h:1162 [inline]
nlmsg_new include/net/netlink.h:953 [inline]
rtmsg_ifinfo_build_skb+0x80/0x180 net/core/rtnetlink.c:3884
rtmsg_ifinfo_event net/core/rtnetlink.c:3920 [inline]
rtmsg_ifinfo+0x71/0x120 net/core/rtnetlink.c:3929
register_netdevice+0x1370/0x16b0 net/core/dev.c:10442
tun_set_iff+0x82a/0xda0 drivers/net/tun.c:2802
__tun_chr_ioctl+0x722/0x1e70 drivers/net/tun.c:3062
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
ffff888016a48380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888016a48400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888016a48480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888016a48500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888016a48580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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.

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
Reply all
Reply to author
Forward
0 new messages