<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-next.git/net/bluetooth, branch master</title>
<subtitle>Linux kernel latest source</subtitle>
<id>http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/'/>
<updated>2026-09-04T17:21:56+00:00</updated>
<entry>
<title>Merge branch 'master' of https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git</title>
<updated>2026-09-04T17:21:56+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2026-09-04T17:21:56+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=dbb5214c3e2174f68af20b1b65c04ef835076ec4'/>
<id>urn:sha1:dbb5214c3e2174f68af20b1b65c04ef835076ec4</id>
<content type='text'>
# Conflicts:
#	net/bluetooth/hci_sync.c
#	net/bluetooth/l2cap_core.c
</content>
</entry>
<entry>
<title>Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del()</title>
<updated>2026-09-04T14:57:20+00:00</updated>
<author>
<name>Krystian Kaniewski</name>
<email>krystianmkaniewski@gmail.com</email>
</author>
<published>2026-09-04T12:24:22+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=21c3501e5f46428a4f7c1e562735c94cf1cbbad9'/>
<id>urn:sha1:21c3501e5f46428a4f7c1e562735c94cf1cbbad9</id>
<content type='text'>
A NULL pointer dereference in klist_put() occurs when a child device (such
as a BNEP network device in bnep_session) is concurrently being
unregistered while hci_conn_del_sysfs() reparents child devices.

This is caused by a race condition between hci_conn_del_sysfs() and
concurrent child device unregistration (e.g. bnep_session calling
unregister_netdev()). During device unregistration, device_del() snapshots
a non-NULL parent pointer. Concurrently, hci_conn_del_sysfs() finds the
child device using device_find_any_child() and calls device_move() to
reparent it to NULL, which removes the node from its parent's klist and
clears knode_parent. Subsequently, device_del() calls
klist_del(&amp;dev-&gt;p-&gt;knode_parent) using the stale parent snapshot, causing
klist_put() to dereference knode_klist(n)-&gt;put on an already removed node,
resulting in a NULL pointer dereference.

This race was introduced by commit 27aabf27fd01 ("Bluetooth: fix
use-after-free in device_for_each_child()"), which replaced
device_find_child(..., __match_tty) with device_find_any_child() in
hci_conn_del_sysfs(). That change was intended to avoid a use-after-free
where conn-&gt;dev outlived its parent hdev-&gt;dev when child devices held
references to conn-&gt;dev, because conn-&gt;dev only held a reference to
hdev-&gt;dev while registered in sysfs.

Fix the issue properly by taking an explicit reference to the parent device
with get_device(&amp;hdev-&gt;dev) in hci_conn_init_sysfs() and dropping it with
put_device(parent) in bt_link_release() when the conn device is freed. This
ensures that hdev-&gt;dev remains valid for the entire lifecycle of conn-&gt;dev,
resolving the underlying use-after-free. With the parent reference held
properly, restore the __match_tty filter in hci_conn_del_sysfs() so that
device_move() is only invoked on persistent RFCOMM TTY devices as
originally intended, eliminating the race condition with unregistering
network devices.

Fixes: 27aabf27fd01 ("Bluetooth: fix use-after-free in device_for_each_child()")
Assisted-by: Gemini:gemini-3.7-flash syzbot
Reported-by: syzbot+6df45dd3d03e1a9aca96@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6df45dd3d03e1a9aca96
Link: https://syzkaller.appspot.com/ai_job?id=f1c0e740-db21-40af-a9ff-84db0fd8b8bd
Signed-off-by: Krystian Kaniewski &lt;krystianmkaniewski@gmail.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: hci_sync: Fix not setting CE length properly</title>
<updated>2026-09-03T19:33:03+00:00</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2026-09-02T17:16:26+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=88a8184cb44c8952e6a6fd21e250445300d1c7aa'/>
<id>urn:sha1:88a8184cb44c8952e6a6fd21e250445300d1c7aa</id>
<content type='text'>
Both hci_le_set_def_rate_sync() and hci_le_conn_rate_request_sync() were
leaving Min_CE_Length and Max_CE_Length set to 0x0000, but the connection
event length recommended in requests by a Peripheral has a valid range of
0x0001 to 0x7CFF (Time = N * 125 us, Time Range: 0.125 ms to 3.999875 s),
so 0x0000 cannot be used.

Set both to the minimum valid value, which is safe since the Controller
is not required to use these values:

BLUETOOTH CORE SPECIFICATION Version 6.2 | Vol 4, Part E
7.8.157. LE Connection Rate Request command
7.8.158. LE Set Default Rate Parameters command

The Min_CE_Length and Max_CE_Length parameters provide the Controller
with the expected minimum and maximum length of the connection events.
The Controller is not required to use these values.

Fixes: 2f8784cfe8a9 ("Bluetooth: Add support for Shorter Connection Interval (SCI) feature")
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: Move H:4 reassembly into the Bluetooth core</title>
<updated>2026-09-02T21:30:36+00:00</updated>
<author>
<name>Luiz Augusto von Dentz</name>
<email>luiz.von.dentz@intel.com</email>
</author>
<published>2026-08-28T20:04:30+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=37521ec2f55f3bb32f99ce2e19c73ecba89a8c9c'/>
<id>urn:sha1:37521ec2f55f3bb32f99ce2e19c73ecba89a8c9c</id>
<content type='text'>
h4_recv_buf() is currently implemented in hci_h4.c which is only built as
part of the hci_uart module, and only when CONFIG_BT_HCIUART_H4 is
enabled. That makes the H:4 reassembly logic unusable by drivers which do
not depend on hci_uart, e.g. btusb which needs it to implement Bulk
Serialization Mode.

Move the transport agnostic part into the Bluetooth core as
h4_recv_skb(), which takes a struct hci_dev instead of a struct hci_uart,
along with struct h4_recv_pkt and the H4_RECV_* helpers, and keep
h4_recv_buf() as a thin wrapper for the hci_uart protocols.

Since every Bluetooth driver already depends on the bluetooth module this
introduces no new module dependency and no new Kconfig symbol.

Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: refuse __l2cap_chan_add if chan already has conn</title>
<updated>2026-09-02T19:55:23+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-09-01T21:04:36+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=6696072ffe07205255cf83621a95a1aa2f9f6e62'/>
<id>urn:sha1:6696072ffe07205255cf83621a95a1aa2f9f6e62</id>
<content type='text'>
l2cap_chan may be linked to l2cap_conn at most once. This is assumed in
several places, eg l2cap_chan_del cleanup.

There is a TOCTOU race where the invariant is violated:

    [Task 1]                          [Task 2]
    l2cap_chan_connect                l2cap_sock_bind
      l2cap_chan_lock                   lock_sock
      l2cap_state_change                if (sk-&gt;sk_state != BT_OPEN)
        chan-&gt;state = BT_CONNECT
        l2cap_sock_state_change_cb      chan-&gt;state = BT_BOUND
                                        sk-&gt;sk_state = BT_BOUND
          lock_sock &lt;------------------ release_sock
          sk-&gt;sk_state = BT_CONNECT

l2cap_sock_connect() does not check sk-&gt;sk_state, so since chan-&gt;state
is now BT_BOUND, subsequent connect() ends up with second
__l2cap_chan_add.

Explicitly document and check the invariant in __l2cap_chan_add with
WARN_ON_ONCE. The only callsite where it could be hit is
l2cap_chan_connect, so add pre-check there to avoid relying on
chan-&gt;state. chan-&gt;state read/write is not properly guarded currently so
there can be other TOCTOUC problems.

Add l2cap_lock_chan in l2cap_sock_bind() to guard chan-&gt;state write.

Fixes: b66774b48dd9 ("Bluetooth: L2CAP: Fix UAF in channel timeout by holding conn ref")
Assisted-by: deepseek-4-flash # finding the race condition
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: annotate locking for l2cap_ops callbacks</title>
<updated>2026-09-02T19:55:02+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-09-01T21:04:35+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=4149ba2a806c46853122d1a7063748429d8fc415'/>
<id>urn:sha1:4149ba2a806c46853122d1a7063748429d8fc415</id>
<content type='text'>
Annotate current locking context for l2cap_ops callbacks.

Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: annotate locking for l2cap_chan_del()</title>
<updated>2026-09-02T19:54:40+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-09-01T21:04:34+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=6873eb51dcdd9ae01f8c682e482c8915dbbb138f'/>
<id>urn:sha1:6873eb51dcdd9ae01f8c682e482c8915dbbb138f</id>
<content type='text'>
Add context analysis annotations for chan-&gt;lock and chan-&gt;conn-&gt;lock
involving l2cap_chan_del() usage.

Add necessary annotations and related lockdep_assert_held to callers.

Move struct l2cap_ops definition after struct l2cap_conn, so that the
callbacks can be annotated.

In l2cap_chan_close_unlocked() we consider chan-&gt;conn-&gt;lock as locked
even if chan-&gt;conn == NULL, to avoid needing to define separate
__l2cap_chan_close/del for this NULL case.

Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: take lock for l2cap_chan_del in l2cap_ecred_rsp_defer</title>
<updated>2026-09-02T19:51:19+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-09-01T21:04:33+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=c6d60c24cd7b3d74d1f7ad5db5651cb581801cc4'/>
<id>urn:sha1:c6d60c24cd7b3d74d1f7ad5db5651cb581801cc4</id>
<content type='text'>
l2cap_ecred_rsp_defer() calls l2cap_chan_del without holding chan-&gt;lock,
which ends up calling ops-&gt;teardown() with wrong lock context.

Fix by taking chan-&gt;lock in l2cap_ecred_rsp_defer().  AB-BA deadlocks
between sibling l2cap_chan are avoided here via requiring l2cap_conn::lock
to serialize all nested l2cap_chan locking on same nesting level.

In current code, there is no nested l2cap_chan locking on same nesting
level, so we can add this new requirement.

Also return early from  __l2cap_ecred_conn_rsp_defer() if chan did not
have FLAG_DEFER_SETUP, as then no RSP shall be sent for it, to make sure
SMP channels are excluded.

Also hold chan reference over l2cap_chan_del(), in case chan_l reference
was the last.

Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: remove conditional locking from l2cap_connect()</title>
<updated>2026-09-01T17:38:14+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-08-29T14:20:10+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=2c127ee79a0b260fa4a4042c36542e772f7c20f5'/>
<id>urn:sha1:2c127ee79a0b260fa4a4042c36542e772f7c20f5</id>
<content type='text'>
Context analysis does not understand conditional locking.

Restructure l2cap_connect() by removing conditional locking at the cost
of some code duplication, so that static analysis can see its content.

Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
<entry>
<title>Bluetooth: L2CAP: hold chan in l2cap_ecred_conn_rsp()</title>
<updated>2026-09-01T17:37:58+00:00</updated>
<author>
<name>Pauli Virtanen</name>
<email>pav@iki.fi</email>
</author>
<published>2026-08-29T14:20:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/linux-next.git/commit/?id=26836086682ac9017a53b6bd3be1bb7e37dcec2c'/>
<id>urn:sha1:26836086682ac9017a53b6bd3be1bb7e37dcec2c</id>
<content type='text'>
l2cap_chan_del() calls l2cap_chan_put() to drop the conn-&gt;chan_l
reference.  If this was the last reference, UAF follows.

l2cap_ecred_conn_rsp() iterates chan_l list and calls l2cap_chan_del()
on some members, without holding chan reference.

Fix by holding refcount while using chan after l2cap_chan_del().

Since orig is looked up by dcid provided by remote, it's also possible
orig == chan, so reference needs to be held also after orig use.

Fixes: 41c2713b204e ("Bluetooth: L2CAP: Fix possible crash on l2cap_ecred_conn_rsp")
Assisted-by: deepseek-v4-flash
Signed-off-by: Pauli Virtanen &lt;pav@iki.fi&gt;
Signed-off-by: Luiz Augusto von Dentz &lt;luiz.von.dentz@intel.com&gt;
</content>
</entry>
</feed>
