linux/net/bluetooth
Luiz Augusto von Dentz 46e5b71666 Bluetooth: L2CAP: Fix accepting multiple L2CAP_ECRED_CONN_REQ
[ Upstream commit 5b3e205233 ]

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: 15f02b9105 ("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>
History 2026-04-18 10:33:39 +02:00
..
bnep Bluetooth: bnep: fix wild-memory-access in proto_unregister 2024-11-01 01:52:34 +01:00
cmtp exit: Rename module_put_and_exit to module_put_and_kthread_exit 2024-04-10 16:18:55 +02:00
hidp Bluetooth: HIDP: Fix possible UAF 2026-04-18 10:33:20 +02:00
rfcomm Bluetooth: RFCOMM: Fix not validating setsockopt user input 2025-02-01 18:24:01 +01:00
6lowpan.c Bluetooth: 6lowpan: Don't hold spin lock over sleeping functions 2025-12-07 06:09:27 +09:00
a2mp.c Bluetooth: a2mp: Use the correct print format 2021-06-26 07:12:41 +02:00
a2mp.h Bluetooth: Replace zero-length array with flexible-array member 2020-02-28 08:30:02 +01:00
af_bluetooth.c Bluetooth: SCO: Fix UAF on sco_sock_timeout 2025-05-02 07:44:25 +02:00
amp.c Bluetooth: amp: Use the correct print format 2021-06-26 07:12:41 +02:00
amp.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
aosp.c Bluetooth: Add support for reading AOSP vendor capabilities 2021-04-06 14:11:23 -07:00
aosp.h Bluetooth: Add support for reading AOSP vendor capabilities 2021-04-06 14:11:23 -07:00
ecdh_helper.c crypto: ecdh - move curve_id of ECDH from the key to algorithm name 2021-03-13 00:04:03 +11:00
ecdh_helper.h Fix misc new gcc warnings 2021-04-27 17:05:53 -07:00
hci_conn.c Bluetooth: hci_conn: use mod_delayed_work for active mode timeout 2026-03-04 07:20:10 -05:00
hci_core.c Bluetooth: Fix hci_suspend_sync crash 2026-02-06 16:42:04 +01:00
hci_debugfs.c Bluetooth: Fix TOCTOU in HCI debugfs implementation 2024-04-10 16:19:37 +02:00
hci_debugfs.h Bluetooth: Provide option to enable/disable debugfs information 2015-02-15 18:54:13 +02:00
hci_event.c Bluetooth: hci_event: call disconnect callback before deleting conn 2026-02-11 13:35:34 +01:00
hci_request.c Bluetooth: Fix memory leak in hci_req_sync_complete() 2024-04-17 11:15:13 +02:00
hci_request.h Bluetooth: Resume advertising after LE connection 2020-11-09 13:33:19 +01:00
hci_sock.c Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name 2023-10-25 11:59:04 +02:00
hci_sysfs.c Bluetooth: fix use-after-free in device_for_each_child() 2024-12-14 19:50:59 +01:00
Kconfig Bluetooth: Add support for reading AOSP vendor capabilities 2021-04-06 14:11:23 -07:00
l2cap_core.c Bluetooth: L2CAP: Fix accepting multiple L2CAP_ECRED_CONN_REQ 2026-04-18 10:33:39 +02:00
l2cap_sock.c Bluetooth: L2CAP: Fix null-ptr-deref on l2cap_sock_ready_cb 2026-04-18 10:33:24 +02:00
leds.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
leds.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lib.c Bluetooth: Introduce debug feature when dynamic debug is disabled 2020-05-11 12:16:27 +02:00
Makefile Bluetooth: Add support for reading AOSP vendor capabilities 2021-04-06 14:11:23 -07:00
mgmt.c Bluetooth: MGMT: validate LTK enc_size on load 2026-04-18 10:33:30 +02:00
mgmt_config.c Bluetooth: mgmt: Use the correct print format 2021-06-26 07:12:42 +02:00
mgmt_config.h Bluetooth: mgmt: Add commands for runtime configuration 2020-06-18 13:11:03 +03:00
mgmt_util.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
mgmt_util.h Bluetooth: Add generic mgmt helper API 2015-03-17 18:03:08 +01:00
msft.c Bluetooth: msft: Use the correct print format 2021-06-26 07:12:42 +02:00
msft.h Bluetooth: Allow Microsoft extension to indicate curve validation 2021-04-08 12:26:34 +02:00
sco.c Bluetooth: SCO: Fix use-after-free in sco_recv_frame() due to missing sock_hold 2026-04-18 10:33:24 +02:00
selftest.c crypto: ecdh - move curve_id of ECDH from the key to algorithm name 2021-03-13 00:04:03 +11:00
selftest.h Bluetooth: Add support for self testing framework 2014-12-30 08:53:55 +02:00
smp.c Bluetooth: SMP: force responder MITM requirements before building the pairing response 2026-04-18 10:33:32 +02:00
smp.h Bluetooth: SMP: If an unallowed command is received consider it a failure 2025-08-28 16:24:01 +02:00