From: CJ <firefly0158@163.com>
To: marcel@holtmann.org, johan.hedberg@gmail.com,
luiz.dentz@gmail.com, davem@davemloft.net, kuba@kernel.org
Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [BUG] Bluetooth: rfcomm: possible circular locking dependency in the SAK vs. connect path
Date: Mon, 21 Sep 2026 18:05:47 +0800 (CST) [thread overview]
Message-ID: <6572ca06.97a1.1a0c36dcb5f.Coremail.firefly0158@163.com> (raw)
Hi,
I am reporting an issue triggered by a syzkaller reproducer on Linux
7.3.0-rc2. The issue is reproducible with HEAD commit
df2908090cda368b01ff43709f51890076c56157.
The reproducer creates an RFCOMM socket on a vhci-backed HCI device, binds
and listens on it, and then injects four crafted RFCOMM frames through
syz_emit_vhci(). The frames drive the RFCOMM receiver into the connection
indication path.
Lockdep reports a circular locking dependency involving rfcomm. On the
reporting side the task holds console_lock (taken in vc_SAK) and tries to
acquire the tty buffer lock (&buf->lock, at tty_buffer_flush); the reverse
dependency chain shows console_lock being acquired by con_flush_chars() from
n_tty_write(). The lock class of interest for rfcomm is entered through
lock_sock_nested() from rfcomm_connect_ind(), which the earlier report on
linux-6.1 also showed.
This looks like a lock ordering problem between the RFCOMM receive/setup
path and the tty/console teardown path, rather than a specific bad pointer.
The earlier report against the same reproducer described the matching edge
of the cycle, with tty termios_rwsem taken at n_tty_flush_buffer() while
holding the tty buffer lock, so the cycle has been reachable for a while and
the participating locks are the same. Serializing the RFCOMM session setup
and teardown against the socket lock would be the direction; I have not
verified which of the recent RFCOMM locking changes already covers it.
This failure was reported earlier against the linux-6.1 longterm series at
https://syzkaller.appspot.com/bug?extid=3a1f869dcd8f26e5c216, and the
reproducer below is the one from that report. It still reproduces on the
tested mainline kernel.
Reproducer:
syz reproducer:
The reproducer is the program below, which requires no large encoded image:
r0 = syz_init_net_socket$bt_rfcomm(0x1f, 0x1, 0x3)
bind$bt_rfcomm(r0, &(0x7f0000000000)={0x1f, @any, 0x1}, 0xa)
listen(r0, 0x5)
syz_emit_vhci(&(0x7f0000000200)=ANY=[@ANYBLOB="02c8200c00080001000202040003004000"], 0x11)
syz_emit_vhci(&(0x7f0000000300)=ANY=[@ANYBLOB="02c8200c00080001000403040040000000"], 0x11)
syz_emit_vhci(&(0x7f0000000400)=ANY=[@ANYBLOB="02c8200e000a00010005010600400000000000"], 0x13)
syz_emit_vhci(&(0x7f0000000600)=ANY=[@ANYBLOB="02c82012000e00400003ef158311020007007f00000770"], 0x17)
console output: https://pastebin.com/raw/zLyVGhi5
kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=31dfefc4a14efea3
Kernel:
HEAD commit: df2908090cda368b01ff43709f51890076c56157
git tree: mainline
kernel version: 7.3.0-rc2
tested tag: v7.3-rc2 (annotated tag object 5e036ce12de91c6fd674dad33b169c6150be2a7a)
Let me know if you need more details or testing.
Best regards,
Changjian Liu
reply other threads:[~2026-09-21 10:06 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=6572ca06.97a1.1a0c36dcb5f.Coremail.firefly0158@163.com \
--to=firefly0158@163.com \
--cc=davem@davemloft.net \
--cc=johan.hedberg@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®