1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/net/bluetooth
Luiz Augusto von Dentz b25120e1d5 Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response
L2CAP_ECRED_CONN_RSP needs to respond DCID in the same order received as
SCID but the order is reversed due to use of list_add which actually
prepend channels to the list so the response is reversed:

> ACL Data RX: Handle 16 flags 0x02 dlen 26
      LE L2CAP: Enhanced Credit Connection Request (0x17) ident 2 len 18
        PSM: 39 (0x0027)
        MTU: 256
        MPS: 251
        Credits: 65535
        Source CID: 116
        Source CID: 117
        Source CID: 118
        Source CID: 119
        Source CID: 120
< ACL Data TX: Handle 16 flags 0x00 dlen 26
      LE L2CAP: Enhanced Credit Connection Response (0x18) ident 2 len 18
        MTU: 517
        MPS: 247
        Credits: 3
        Result: Connection successful (0x0000)
        Destination CID: 68
        Destination CID: 67
        Destination CID: 66
        Destination CID: 65
        Destination CID: 64

Also make sure the response don't include channels that are not on
BT_CONNECT2 since the chan->ident can be set to the same value as in the
following trace:

< ACL Data TX: Handle 16 flags 0x00 dlen 12
      LE L2CAP: LE Flow Control Credit (0x16) ident 6 len 4
        Source CID: 64
        Credits: 1
...
> ACL Data RX: Handle 16 flags 0x02 dlen 18
      LE L2CAP: Enhanced Credit Connection Request (0x17) ident 6 len 10
        PSM: 39 (0x0027)
        MTU: 517
        MPS: 251
        Credits: 255
        Source CID: 70
< ACL Data TX: Handle 16 flags 0x00 dlen 20
      LE L2CAP: Enhanced Credit Connection Response (0x18) ident 6 len 12
        MTU: 517
        MPS: 247
        Credits: 3
        Result: Connection successful (0x0000)
        Destination CID: 64
        Destination CID: 68

Closes: https://github.com/bluez/bluez/issues/1094
Fixes: 9aa9d9473f ("Bluetooth: L2CAP: Fix responding with wrong PDU type")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2025-02-20 13:25:11 -05:00
..
bnep Bluetooth: bnep: fix wild-memory-access in proto_unregister 2024-10-16 16:10:03 -04:00
cmtp Bluetooth: CMTP: Mark BT_CMTP as DEPRECATED 2024-09-10 13:07:08 -04:00
hidp HID: intel-thc: fix CONFIG_HID dependency 2025-02-03 10:56:43 +01:00
rfcomm Bluetooth: btmtk: Fix failed to send func ctrl for MediaTek devices. 2025-01-08 11:14:03 -05:00
6lowpan.c ipv6: introduce dst_rt6_info() helper 2024-04-29 13:32:01 +01:00
af_bluetooth.c Including fixes from netfiler, xfrm and bluetooth. 2024-10-24 16:43:50 -07:00
aosp.c Bluetooth: Fix null pointer deref on unexpected status event 2022-08-08 17:04:37 -07:00
aosp.h Bluetooth: aosp: Support AOSP Bluetooth Quality Report 2021-11-02 19:37:52 +01:00
coredump.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
ecdh_helper.c Bluetooth: Use crypto_wait_req 2023-02-13 18:34:48 +08:00
ecdh_helper.h Fix misc new gcc warnings 2021-04-27 17:05:53 -07:00
eir.c Bluetooth: Fix eir name length 2024-03-08 10:22:17 -05:00
eir.h move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
hci_codec.c Bluetooth: Fix support for Read Local Supported Codecs V2 2022-12-02 13:09:31 -08:00
hci_codec.h Bluetooth: Add support for Read Local Supported Codecs V2 2021-09-07 14:09:18 -07:00
hci_conn.c Bluetooth: ISO: Send BIG Create Sync via hci_sync 2024-11-14 15:39:59 -05:00
hci_core.c Bluetooth: Get rid of cmd_timeout and use the reset callback 2025-01-15 10:36:42 -05:00
hci_debugfs.c Bluetooth: Remove hci_request.{c,h} 2024-07-15 10:11:35 -04:00
hci_debugfs.h Bluetooth: hci_core: Move all debugfs handling to hci_debugfs.c 2021-09-22 16:17:13 +02:00
hci_event.c Bluetooth: hci_event: Fix using rcu_read_(un)lock while iterating 2024-12-12 09:23:49 -05:00
hci_sock.c Bluetooth: Improve setsockopt() handling of malformed user input 2024-12-11 11:54:57 -05:00
hci_sync.c Bluetooth: hci: Remove deadcode 2025-01-15 10:32:20 -05:00
hci_sysfs.c Bluetooth: Allow reset via sysfs 2025-01-15 10:37:07 -05:00
iso.c Bluetooth: iso: Allow BIG re-sync 2025-01-14 16:29:47 -05:00
Kconfig Bluetooth: Remove BT_HS 2024-03-06 17:22:39 -05:00
l2cap_core.c Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response 2025-02-20 13:25:11 -05:00
l2cap_sock.c Bluetooth: L2CAP: Fix corrupted list in hci_chan_del 2025-02-13 11:15:37 -05:00
leds.c Bluetooth: Use led_set_brightness() in LED trigger activate() callback 2024-09-10 13:06:11 -04:00
leds.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lib.c Bluetooth: Add documentation to exported functions in lib 2023-12-22 12:54:55 -05:00
Makefile Bluetooth: Remove hci_request.{c,h} 2024-07-15 10:11:35 -04:00
mgmt.c Mainly individually changelogged singleton patches. The patch series in 2025-01-26 17:50:53 -08: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 move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
mgmt_util.h Bluetooth: Fix a buffer overflow in mgmt_mesh_add() 2023-01-17 15:50:10 -08:00
msft.c Bluetooth: Remove hci_request.{c,h} 2024-07-15 10:11:35 -04:00
msft.h Bluetooth: msft: fix slab-use-after-free in msft_do_close() 2024-05-03 13:05:28 -04:00
sco.c Bluetooth: SCO: Add support for 16 bits transparent voice setting 2024-12-12 09:24:35 -05: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 Revert "Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE" 2024-08-30 17:56:53 -04:00
smp.h Bluetooth: use inclusive language in SMP 2021-06-26 07:12:37 +02:00