WARNING: held lock freed in l2cap_conn_del

3 views
Skip to first unread message

syzbot

unread,
Aug 16, 2022, 5:40:25 PM8/16/22
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6c8f479764eb Add linux-next specific files for 20220809
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1176465b080000
kernel config: https://syzkaller.appspot.com/x/.config?x=a5ae8cfa8d7075d1
dashboard link: https://syzkaller.appspot.com/bug?extid=4f75acc498f391c62c73
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
CC: [da...@davemloft.net edum...@google.com johan....@gmail.com ku...@kernel.org linux-b...@vger.kernel.org linux-...@vger.kernel.org luiz....@gmail.com mar...@holtmann.org net...@vger.kernel.org pab...@redhat.com]

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+4f75ac...@syzkaller.appspotmail.com

Bluetooth: hci1: hardware error 0x04
=========================
WARNING: held lock freed!
5.19.0-next-20220809-syzkaller #0 Not tainted
-------------------------
kworker/u5:7/3664 is freeing memory ffff888075f13000-ffff888075f137ff, with a lock still held there!
ffff888075f13520 (&chan->lock#2/1){+.+.}-{3:3}, at: l2cap_chan_lock include/net/bluetooth/l2cap.h:855 [inline]
ffff888075f13520 (&chan->lock#2/1){+.+.}-{3:3}, at: l2cap_conn_del+0x3b5/0x7b0 net/bluetooth/l2cap_core.c:1920
7 locks held by kworker/u5:7/3664:
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: arch_atomic_long_set include/linux/atomic/atomic-long.h:41 [inline]
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: atomic_long_set include/linux/atomic/atomic-instrumented.h:1280 [inline]
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:636 [inline]
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:663 [inline]
#0: ffff888076bb3938 ((wq_completion)hci1){+.+.}-{0:0}, at: process_one_work+0x87a/0x1610 kernel/workqueue.c:2260
#1: ffffc90003fcfda8 ((work_completion)(&hdev->error_reset)){+.+.}-{0:0}, at: process_one_work+0x8ae/0x1610 kernel/workqueue.c:2264
#2: ffff8880333f8fd0 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close+0x25/0x70 net/bluetooth/hci_core.c:552
#3: ffff8880333f8078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x268/0x1130 net/bluetooth/hci_sync.c:4463
#4: ffffffff8d9cfd28 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_disconn_cfm include/net/bluetooth/hci_core.h:1776 [inline]
#4: ffffffff8d9cfd28 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_conn_hash_flush+0xd5/0x260 net/bluetooth/hci_conn.c:2366
#5: ffff88807dabcad8 (&conn->chan_lock){+.+.}-{3:3}, at: l2cap_conn_del+0x2ef/0x7b0 net/bluetooth/l2cap_core.c:1915
#6: ffff888075f13520 (&chan->lock#2/1){+.+.}-{3:3}, at: l2cap_chan_lock include/net/bluetooth/l2cap.h:855 [inline]
#6: ffff888075f13520 (&chan->lock#2/1){+.+.}-{3:3}, at: l2cap_conn_del+0x3b5/0x7b0 net/bluetooth/l2cap_core.c:1920

stack backtrace:
CPU: 0 PID: 3664 Comm: kworker/u5:7 Not tainted 5.19.0-next-20220809-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Workqueue: hci1 hci_error_reset
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_freed_lock_bug kernel/locking/lockdep.c:6422 [inline]
debug_check_no_locks_freed.cold+0x9d/0xa9 kernel/locking/lockdep.c:6455
slab_free_hook mm/slub.c:1726 [inline]
slab_free_freelist_hook+0x73/0x1c0 mm/slub.c:1780
slab_free mm/slub.c:3534 [inline]
kfree+0xe2/0x580 mm/slub.c:4562
l2cap_chan_destroy net/bluetooth/l2cap_core.c:503 [inline]
kref_put include/linux/kref.h:65 [inline]
l2cap_chan_put+0x22a/0x2d0 net/bluetooth/l2cap_core.c:527
l2cap_conn_del+0x3fc/0x7b0 net/bluetooth/l2cap_core.c:1924
l2cap_disconn_cfm net/bluetooth/l2cap_core.c:8213 [inline]
l2cap_disconn_cfm+0x8c/0xc0 net/bluetooth/l2cap_core.c:8206
hci_disconn_cfm include/net/bluetooth/hci_core.h:1779 [inline]
hci_conn_hash_flush+0x122/0x260 net/bluetooth/hci_conn.c:2366
hci_dev_close_sync+0x55d/0x1130 net/bluetooth/hci_sync.c:4476
hci_dev_do_close+0x2d/0x70 net/bluetooth/hci_core.c:554
hci_error_reset+0x96/0x130 net/bluetooth/hci_core.c:1050
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0xa6/0x5e0 kernel/locking/mutex.c:916
Read of size 8 at addr ffff888075f134b8 by task kworker/u5:7/3664

CPU: 1 PID: 3664 Comm: kworker/u5:7 Not tainted 5.19.0-next-20220809-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Workqueue: hci1 hci_error_reset
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:317 [inline]
print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
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_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline]
__mutex_unlock_slowpath+0xa6/0x5e0 kernel/locking/mutex.c:916
l2cap_chan_unlock include/net/bluetooth/l2cap.h:860 [inline]
l2cap_conn_del+0x404/0x7b0 net/bluetooth/l2cap_core.c:1926
l2cap_disconn_cfm net/bluetooth/l2cap_core.c:8213 [inline]
l2cap_disconn_cfm+0x8c/0xc0 net/bluetooth/l2cap_core.c:8206
hci_disconn_cfm include/net/bluetooth/hci_core.h:1779 [inline]
hci_conn_hash_flush+0x122/0x260 net/bluetooth/hci_conn.c:2366
hci_dev_close_sync+0x55d/0x1130 net/bluetooth/hci_sync.c:4476
hci_dev_do_close+0x2d/0x70 net/bluetooth/hci_core.c:554
hci_error_reset+0x96/0x130 net/bluetooth/hci_core.c:1050
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>

Allocated by task 3667:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:437 [inline]
____kasan_kmalloc mm/kasan/common.c:516 [inline]
____kasan_kmalloc mm/kasan/common.c:475 [inline]
__kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525
kmalloc include/linux/slab.h:600 [inline]
kzalloc include/linux/slab.h:733 [inline]
l2cap_chan_create+0x40/0x570 net/bluetooth/l2cap_core.c:463
a2mp_chan_open net/bluetooth/a2mp.c:771 [inline]
amp_mgr_create+0x8f/0x960 net/bluetooth/a2mp.c:862
a2mp_channel_create+0x7d/0x150 net/bluetooth/a2mp.c:894
l2cap_data_channel net/bluetooth/l2cap_core.c:7570 [inline]
l2cap_recv_frame+0x48e3/0x8d90 net/bluetooth/l2cap_core.c:7725
l2cap_recv_acldata+0xaa6/0xc00 net/bluetooth/l2cap_core.c:8430
hci_acldata_packet net/bluetooth/hci_core.c:3777 [inline]
hci_rx_work+0x705/0x1230 net/bluetooth/hci_core.c:4012
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Freed by task 3664:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track+0x21/0x30 mm/kasan/common.c:45
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
____kasan_slab_free mm/kasan/common.c:367 [inline]
____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1754 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780
slab_free mm/slub.c:3534 [inline]
kfree+0xe2/0x580 mm/slub.c:4562
l2cap_chan_destroy net/bluetooth/l2cap_core.c:503 [inline]
kref_put include/linux/kref.h:65 [inline]
l2cap_chan_put+0x22a/0x2d0 net/bluetooth/l2cap_core.c:527
l2cap_conn_del+0x3fc/0x7b0 net/bluetooth/l2cap_core.c:1924
l2cap_disconn_cfm net/bluetooth/l2cap_core.c:8213 [inline]
l2cap_disconn_cfm+0x8c/0xc0 net/bluetooth/l2cap_core.c:8206
hci_disconn_cfm include/net/bluetooth/hci_core.h:1779 [inline]
hci_conn_hash_flush+0x122/0x260 net/bluetooth/hci_conn.c:2366
hci_dev_close_sync+0x55d/0x1130 net/bluetooth/hci_sync.c:4476
hci_dev_do_close+0x2d/0x70 net/bluetooth/hci_core.c:554
hci_error_reset+0x96/0x130 net/bluetooth/hci_core.c:1050
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff888075f13000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1208 bytes inside of
2048-byte region [ffff888075f13000, ffff888075f13800)

The buggy address belongs to the physical page:
page:ffffea0001d7c400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888075f10000 pfn:0x75f10
head:ffffea0001d7c400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000d2cc08 ffffea0001ba4008 ffff888011842000
raw: ffff888075f10000 0000000000080004 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 143, tgid 143 (kworker/0:2), ts 238143030228, free_ts 238128902707
prep_new_page mm/page_alloc.c:2532 [inline]
get_page_from_freelist+0x109b/0x2cd0 mm/page_alloc.c:4283
__alloc_pages+0x1c7/0x510 mm/page_alloc.c:5507
alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
alloc_slab_page mm/slub.c:1824 [inline]
allocate_slab+0x27e/0x3d0 mm/slub.c:1969
new_slab mm/slub.c:2029 [inline]
___slab_alloc+0x7f1/0xe10 mm/slub.c:3031
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118
slab_alloc_node mm/slub.c:3209 [inline]
__kmalloc_node_track_caller+0x2f2/0x380 mm/slub.c:4955
kmalloc_reserve net/core/skbuff.c:358 [inline]
__alloc_skb+0xd9/0x2f0 net/core/skbuff.c:430
alloc_skb include/linux/skbuff.h:1257 [inline]
alloc_skb_with_frags+0x93/0x6c0 net/core/skbuff.c:6018
sock_alloc_send_pskb+0x7a3/0x930 net/core/sock.c:2663
sock_alloc_send_skb include/net/sock.h:1813 [inline]
mld_newpack.isra.0+0x1b9/0x770 net/ipv6/mcast.c:1748
add_grhead+0x295/0x340 net/ipv6/mcast.c:1851
add_grec+0x1082/0x1560 net/ipv6/mcast.c:1989
mld_send_cr net/ipv6/mcast.c:2115 [inline]
mld_ifc_work+0x452/0xdc0 net/ipv6/mcast.c:2653
process_one_work+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1449 [inline]
free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
free_unref_page_prepare mm/page_alloc.c:3380 [inline]
free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:727 [inline]
slab_alloc_node mm/slub.c:3243 [inline]
slab_alloc mm/slub.c:3251 [inline]
kmem_cache_alloc_trace+0x2c0/0x3e0 mm/slub.c:3282
kmalloc include/linux/slab.h:600 [inline]
kzalloc include/linux/slab.h:733 [inline]
fib6_info_alloc+0xc1/0x210 net/ipv6/ip6_fib.c:156
ip6_route_info_create+0x33e/0x1aa0 net/ipv6/route.c:3749
ip6_route_add+0x24/0x150 net/ipv6/route.c:3843
addrconf_add_mroute+0x1e1/0x310 net/ipv6/addrconf.c:2489
addrconf_add_dev+0x156/0x1c0 net/ipv6/addrconf.c:2507
addrconf_dev_config+0x1ec/0x410 net/ipv6/addrconf.c:3382
addrconf_notify+0xdd3/0x1b90 net/ipv6/addrconf.c:3631
notifier_call_chain+0xb5/0x200 kernel/notifier.c:87
call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945
call_netdevice_notifiers_extack net/core/dev.c:1983 [inline]
call_netdevice_notifiers net/core/dev.c:1997 [inline]
__dev_notify_flags+0x110/0x2b0 net/core/dev.c:8594

Memory state around the buggy address:
ffff888075f13380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888075f13400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888075f13480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888075f13500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888075f13580: 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.

syzbot

unread,
Sep 23, 2022, 10:23:37 PM9/23/22
to syzkaller-upst...@googlegroups.com
Sending this report upstream.
Reply all
Reply to author
Forward
0 new messages