]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Bluetooth: L2CAP: Fix accepting multiple L2CAP_ECRED_CONN_REQ
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sun, 22 Mar 2026 01:27:39 +0000 (21:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:33:39 +0000 (10:33 +0200)
commit46e5b71666fb7652082e4e214a3365f4b14f1dc3
treefaca16567902c5122d29980e11fb4be86ab5792d
parente68c267787778bcdf3d91b06f794faaba7f0d1d1
Bluetooth: L2CAP: Fix accepting multiple L2CAP_ECRED_CONN_REQ

[ Upstream commit 5b3e2052334f2ff6d5200e952f4aa66994d09899 ]

Currently the code attempts to accept requests regardless of the
command identifier which may cause multiple requests to be marked
as pending (FLAG_DEFER_SETUP) which can cause more than
L2CAP_ECRED_MAX_CID(5) to be allocated in l2cap_ecred_rsp_defer
causing an overflow.

The spec is quite clear that the same identifier shall not be used on
subsequent requests:

'Within each signaling channel a different Identifier shall be used
for each successive request or indication.'
https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-62/out/en/host/logical-link-control-and-adaptation-protocol-specification.html#UUID-32a25a06-4aa4-c6c7-77c5-dcfe3682355d

So this attempts to check if there are any channels pending with the
same identifier and rejects if any are found.

Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
Reported-by: Yiming Qian <yimingqian591@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ adapted variable names ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bluetooth/l2cap_core.c