All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+cdae834448ec8c3602fe@syzkaller.appspotmail.com>
To: eadavis@qq.com, linux-kernel@vger.kernel.org,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in l2cap_sock_new_connection_cb
Date: Tue, 25 Nov 2025 05:46:01 -0800	[thread overview]
Message-ID: <6925b319.a70a0220.d98e3.00a9.GAE@google.com> (raw)
In-Reply-To: <tencent_1BFD192ACFEF0D8BA5908DE0123C5D9CDD07@qq.com>

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
possible deadlock in l2cap_sock_shutdown

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.19/6669 is trying to acquire lock:
ffff88803a345588 (&chan->lock/2){+.+.}-{4:4}, at: l2cap_chan_lock include/net/bluetooth/l2cap.h:827 [inline]
ffff88803a345588 (&chan->lock/2){+.+.}-{4:4}, at: l2cap_sock_shutdown+0x9f3/0x1130 net/bluetooth/l2cap_sock.c:1374

but task is already holding lock:
ffffffff8e9e3238 (ra_lock){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:228 [inline]
ffffffff8e9e3238 (ra_lock){+.+.}-{4:4}, at: l2cap_sock_release+0x5e/0x260 net/bluetooth/l2cap_sock.c:1427

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (ra_lock){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/rtmutex_api.c:535 [inline]
       mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:547
       class_mutex_constructor include/linux/mutex.h:228 [inline]
       l2cap_sock_new_connection_cb+0x4e/0x300 net/bluetooth/l2cap_sock.c:1477
       l2cap_connect_cfm+0x37a/0x1040 net/bluetooth/l2cap_core.c:7288
       hci_connect_cfm+0x95/0x140 include/net/bluetooth/hci_core.h:2107
       le_conn_complete_evt+0xfb8/0x1500 net/bluetooth/hci_event.c:5799
       hci_le_conn_complete_evt+0x187/0x450 net/bluetooth/hci_event.c:5825
       hci_event_func net/bluetooth/hci_event.c:7586 [inline]
       hci_event_packet+0x78f/0x1200 net/bluetooth/hci_event.c:7643
       hci_rx_work+0x46a/0xe80 net/bluetooth/hci_core.c:4099
       process_one_work kernel/workqueue.c:3263 [inline]
       process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427
       kthread+0x711/0x8a0 kernel/kthread.c:463
       ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (&chan->lock/2){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
       __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
       __mutex_lock_common kernel/locking/rtmutex_api.c:535 [inline]
       mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:547
       l2cap_chan_lock include/net/bluetooth/l2cap.h:827 [inline]
       l2cap_sock_shutdown+0x9f3/0x1130 net/bluetooth/l2cap_sock.c:1374
       l2cap_sock_release+0x82/0x260 net/bluetooth/l2cap_sock.c:1432
       __sock_release net/socket.c:662 [inline]
       sock_close+0xc3/0x240 net/socket.c:1455
       __fput+0x45b/0xa80 fs/file_table.c:468
       task_work_run+0x1d4/0x260 kernel/task_work.c:227
       resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
       exit_to_user_mode_loop+0xe9/0x130 kernel/entry/common.c:43
       exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
       syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline]
       syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline]
       do_syscall_64+0x2bd/0xfa0 arch/x86/entry/syscall_64.c:100
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ra_lock);
                               lock(&chan->lock/2);
                               lock(ra_lock);
  lock(&chan->lock/2);

 *** DEADLOCK ***

2 locks held by syz.2.19/6669:
 #0: ffff8880480cd6f8 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:980 [inline]
 #0: ffff8880480cd6f8 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: __sock_release net/socket.c:661 [inline]
 #0: ffff8880480cd6f8 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: sock_close+0x9b/0x240 net/socket.c:1455
 #1: ffffffff8e9e3238 (ra_lock){+.+.}-{4:4}, at: class_mutex_constructor include/linux/mutex.h:228 [inline]
 #1: ffffffff8e9e3238 (ra_lock){+.+.}-{4:4}, at: l2cap_sock_release+0x5e/0x260 net/bluetooth/l2cap_sock.c:1427

stack backtrace:
CPU: 1 UID: 0 PID: 6669 Comm: syz.2.19 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3165 [inline]
 check_prevs_add kernel/locking/lockdep.c:3284 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
 __mutex_lock_common kernel/locking/rtmutex_api.c:535 [inline]
 mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:547
 l2cap_chan_lock include/net/bluetooth/l2cap.h:827 [inline]
 l2cap_sock_shutdown+0x9f3/0x1130 net/bluetooth/l2cap_sock.c:1374
 l2cap_sock_release+0x82/0x260 net/bluetooth/l2cap_sock.c:1432
 __sock_release net/socket.c:662 [inline]
 sock_close+0xc3/0x240 net/socket.c:1455
 __fput+0x45b/0xa80 fs/file_table.c:468
 task_work_run+0x1d4/0x260 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop+0xe9/0x130 kernel/entry/common.c:43
 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline]
 do_syscall_64+0x2bd/0xfa0 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc22a98f749
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff1d93f9c8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fc22abe7da0 RCX: 00007fc22a98f749
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fc22abe7da0 R08: 0000000000000000 R09: 000000141d93fcbf
R10: 000000000003fd20 R11: 0000000000000246 R12: 000000000002b06f
R13: 00007fff1d93fac0 R14: ffffffffffffffff R15: 00007fff1d93fae0
 </TASK>


Tested on:

commit:         ac3fd01e Linux 6.18-rc7
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=155ec57c580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=38a0c4cddc846161
dashboard link: https://syzkaller.appspot.com/bug?extid=cdae834448ec8c3602fe
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1280cf42580000


  reply	other threads:[~2025-11-25 13:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  8:46 [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in l2cap_sock_new_connection_cb syzbot
2025-11-24  4:01 ` syzbot
2025-11-25 12:13   ` Edward Adam Davis
2025-11-25 12:50     ` syzbot
2025-11-25 13:07   ` Edward Adam Davis
2025-11-25 13:46     ` syzbot [this message]
2025-11-25 13:55   ` Edward Adam Davis
2025-11-25 14:54     ` syzbot

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=6925b319.a70a0220.d98e3.00a9.GAE@google.com \
    --to=syzbot+cdae834448ec8c3602fe@syzkaller.appspotmail.com \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /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.