From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v4 0/2] L2CAP: Fix channels being established with insufficient security
Date: Tue, 24 Nov 2026 15:50:23 -0500 [thread overview]
Message-ID: <20261124205025.736808-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
l2cap_security_cfm() lowers the security level of a channel to the one
of the link when encryption completes, and accepts channels waiting for
the security to be met as long as the status is success, so a channel
can end up established, or be offered to a listener using
BT_DEFER_SETUP, over a link that doesn't meet the security level it
requires, e.g. if the peer disables encryption while the channel waits
for userspace to authorize it.
The first patch makes l2cap_security_cfm() compare the security level
of the link with the one required by the channel: encryption completing
below it is a downgrade, so the channel is no longer lowered to match
it but disconnected, or refused if it was still pending, and the link is
disconnected if the channel is a fixed one since it can't be
disconnected at L2CAP. Channels waiting to be accepted or started only
proceed if the link meets their security level.
The second patch makes a BR/EDR channel visible to the listener only
once it is offered to it, after the security is met, instead of as soon
as the connection request is responded as pending, so a listener that
accepts without waiting to be notified can't authorize a connection
while authentication is still pending.
Tests for both are sent to the BlueZ mailing list as "[PATCH BlueZ v3
0/5] Add tests for security of deferred setup".
A channel requiring a security level that pairing can't provide, e.g.
BT_SECURITY_HIGH when the IO capability is NoInputNoOutput, is now
refused instead of being connected with the security level the link
ended up with.
v4:
- Disconnect the link instead of the channel if a fixed channel is
downgraded, since it can't be disconnected at L2CAP.
- Call chan->ops->close() when a channel was deleted by the downgrade,
so its socket is not leaked, and also refuse deferred LE Credit
Based channels in BT_CONNECT2.
- Only start channels in BT_CONNECT if the link meets their security
level.
v3:
- Don't use l2cap_chan_check_security(), which may start
authentication or encryption, compare the security levels instead.
- Treat encryption completing below the security level of a channel as
a downgrade and disconnect it instead of lowering its security
level.
- Only let accept() return children in BT_CONNECT2, as
bt_accept_poll() does.
v2:
- Drop BT_SK_ACCEPTED and the changes to l2cap_sock_defer().
- Add the second patch for listeners accepting while the security is
still pending.
Luiz Augusto von Dentz (1):
Bluetooth: L2CAP: Don't offer deferred channels before security is met
Mohammed Alquraini (1):
Bluetooth: L2CAP: Fix accepting channels with insufficient security
net/bluetooth/af_bluetooth.c | 6 +++-
net/bluetooth/l2cap_core.c | 58 ++++++++++++++++++++++++++++++++----
net/bluetooth/l2cap_sock.c | 10 ++++++-
3 files changed, 66 insertions(+), 8 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-24 20:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 20:50 Luiz Augusto von Dentz [this message]
2026-11-24 20:50 ` [PATCH v4 1/2] Bluetooth: L2CAP: Fix accepting channels with insufficient security Luiz Augusto von Dentz
2026-11-24 20:50 ` [PATCH v4 2/2] Bluetooth: L2CAP: Don't offer deferred channels before security is met Luiz Augusto von Dentz
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=20261124205025.736808-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@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