linux/net/bluetooth
Hui Peng 6d91041bb3 Bluetooth: RFCOMM: Reject short EA=0 frames in rfcomm_recv_frame()
While rfcomm_recv_frame() verifies that skb->len is at least
sizeof(*hdr) + 1 (4 bytes: 3-byte header + 1-byte FCS), an RFCOMM frame
with an extended 2-byte length field (!__test_ea(hdr->len)) has a 4-byte
header plus a 1-byte FCS (5 bytes minimum, sizeof(*hdr) + 2).

When a 4-byte RFCOMM frame with EA == 0 arrives:
1. The initial skb->len < sizeof(*hdr) + 1 check passes (4 < 4 is false).
2. Trimming the FCS byte decrements skb->len to 3.
3. If __check_fcs() succeeds, skb_pull(skb, 4) fails (4 > 3) and returns
   NULL without advancing skb->data.
4. Because the return value of skb_pull() is ignored, the un-pulled
   3-byte struct rfcomm_hdr remains at skb->data and is either queued as
   application payload via rfcomm_recv_data() or parsed as a multiplexer
   control command via rfcomm_recv_mcc() on DLCI 0.

Fix this by extending the length check in rfcomm_recv_frame() to also
require skb->len >= sizeof(*hdr) + 2 when !__test_ea(hdr->len).

Fixes: b230e5bf50 ("Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2026-09-21 09:37:20 -04:00
..
bnep Bluetooth: bnep: fix out-of-bounds reads on short RX/TX frames and control fallthrough 2026-09-21 09:37:19 -04:00
hidp Bluetooth: fix BT dependency for submodules 2026-08-07 15:38:30 -04:00
rfcomm Bluetooth: RFCOMM: Reject short EA=0 frames in rfcomm_recv_frame() 2026-09-21 09:37:20 -04:00
6lowpan.c Bluetooth: add annotations for l2cap_data locking context 2026-08-07 15:38:32 -04:00
af_bluetooth.c Bluetooth: af_bluetooth: Add minimal context analysis annotations 2026-08-07 12:26:02 -04:00
aosp.c Bluetooth: aosp: Fix typo in comment 2025-07-23 10:30:18 -04:00
aosp.h Bluetooth: aosp: Support AOSP Bluetooth Quality Report 2021-11-02 19:37:52 +01:00
coredump.c Bluetooth: coredump: Quiesce dump work on unregister 2026-09-15 14:49:41 -04:00
ecdh_helper.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
ecdh_helper.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
eir.c Bluetooth: eir: validate service data length before reading UUID 2026-09-15 14:30:14 -04:00
eir.h Bluetooth: eir: Fix possible crashes on eir_create_adv_data 2025-06-11 16:29:22 -04:00
hci_codec.c Bluetooth: hci_codec: validate vendor codec count length 2026-09-15 14:52:12 -04: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: balance the parent hold in hci_bind_bis() 2026-09-16 13:51:34 -04:00
hci_core.c Bluetooth: coredump: Quiesce dump work on unregister 2026-09-15 14:49:41 -04:00
hci_debugfs.c Bluetooth: simplify force_no_mitm_write() with kstrtobool_from_user() 2026-08-07 12:27:39 -04:00
hci_debugfs.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
hci_drv.c Bluetooth: Introduce HCI Driver protocol 2025-05-21 10:28:07 -04:00
hci_event.c Bluetooth: hci_event: clear HCI_LE_ADV only on a created connection 2026-08-24 13:11:42 -04:00
hci_sock.c Bluetooth: hci_sock: validate event length before filtering 2026-09-16 13:51:34 -04:00
hci_sync.c Bluetooth: hci_sync: Serialize local codec list cleanup 2026-09-15 14:52:31 -04:00
hci_sysfs.c Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del() 2026-09-08 17:12:45 -04:00
iso.c Bluetooth: ISO: release unused CIS holds after channel attach 2026-09-16 13:51:34 -04:00
Kconfig Bluetooth: fix BT dependency for submodules 2026-08-07 15:38:30 -04:00
l2cap_core.c Bluetooth: L2CAP: validate frame length before control and FCS access 2026-09-16 13:51:34 -04:00
l2cap_sock.c Bluetooth: L2CAP: fix race l2cap_sock_cleanup_listen() vs. put_chan 2026-08-24 13:06:49 -04:00
leds.c Bluetooth: Use led_set_brightness() in LED trigger activate() callback 2024-09-10 13:06:11 -04:00
leds.h
lib.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
Makefile Bluetooth: enable context analysis 2026-08-07 12:27:20 -04:00
mgmt_config.c Bluetooth: mgmt: Add idle_timeout to configurable system parameters 2026-01-29 13:24:22 -05:00
mgmt_config.h Bluetooth: mgmt: Add commands for runtime configuration 2020-06-18 13:11:03 +03:00
mgmt_util.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
mgmt_util.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
mgmt.c Bluetooth: mgmt: fix race in read_unconf_index_list() 2026-09-16 13:51:34 -04:00
msft.c Bluetooth: hci_core: Fix race condition during device registration 2026-08-31 13:52:54 -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: give the socket its own sco_conn reference 2026-07-28 16:13:48 -04:00
selftest.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
selftest.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
smp.c Bluetooth: SMP: reject Security Request over BR/EDR 2026-09-16 13:32:23 -04:00
smp.h Bluetooth: add annotations for l2cap_data locking context 2026-08-07 15:38:32 -04:00