linux/net/bluetooth
hkbinbin bc39a09473 Bluetooth: hci_sync: fix stack buffer overflow in hci_le_big_create_sync
hci_le_big_create_sync() uses DEFINE_FLEX to allocate a
struct hci_cp_le_big_create_sync on the stack with room for 0x11 (17)
BIS entries.  However, conn->num_bis can hold up to HCI_MAX_ISO_BIS (31)
entries — validated against ISO_MAX_NUM_BIS (0x1f) in the caller
hci_conn_big_create_sync().  When conn->num_bis is between 18 and 31,
the memcpy that copies conn->bis into cp->bis writes up to 14 bytes
past the stack buffer, corrupting adjacent stack memory.

This is trivially reproducible: binding an ISO socket with
bc_num_bis = ISO_MAX_NUM_BIS (31) and calling listen() will
eventually trigger hci_le_big_create_sync() from the HCI command
sync worker, causing a KASAN-detectable stack-out-of-bounds write:

  BUG: KASAN: stack-out-of-bounds in hci_le_big_create_sync+0x256/0x3b0
  Write of size 31 at addr ffffc90000487b48 by task kworker/u9:0/71

Fix this by changing the DEFINE_FLEX count from the incorrect 0x11 to
HCI_MAX_ISO_BIS, which matches the maximum number of BIS entries that
conn->bis can actually carry.

Fixes: 42ecf19471 ("Bluetooth: ISO: Do not emit LE BIG Create Sync if previous is pending")
Cc: stable@vger.kernel.org
Signed-off-by: hkbinbin <hkbinbinbin@gmail.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2026-04-01 16:48:28 -04:00
..
bnep
cmtp Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
hidp Bluetooth: HIDP: Fix possible UAF 2026-03-12 15:27:46 -04:00
rfcomm Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
6lowpan.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig
Makefile
af_bluetooth.c
aosp.c
aosp.h
coredump.c
ecdh_helper.c
ecdh_helper.h
eir.c
eir.h
hci_codec.c
hci_codec.h
hci_conn.c Bluetooth: hci_conn: fix potential UAF in set_cig_params_sync 2026-04-01 16:46:33 -04:00
hci_core.c Bluetooth: hci_sync: annotate data-races around hdev->req_status 2026-03-19 14:43:20 -04:00
hci_debugfs.c
hci_debugfs.h
hci_drv.c
hci_event.c Bluetooth: hci_event: fix potential UAF in hci_le_remote_conn_param_req_evt 2026-04-01 16:46:55 -04:00
hci_sock.c Bluetooth: purge error queues in socket destructors 2026-02-23 15:30:16 -05:00
hci_sync.c Bluetooth: hci_sync: fix stack buffer overflow in hci_le_big_create_sync 2026-04-01 16:48:28 -04:00
hci_sysfs.c
iso.c Including fixes from IPsec, Bluetooth and netfilter 2026-02-26 08:00:13 -08:00
l2cap_core.c Bluetooth: L2CAP: Fix ERTM re-init and zero pdu_len infinite loop 2026-03-25 15:32:32 -04:00
l2cap_sock.c Bluetooth: L2CAP: Fix null-ptr-deref on l2cap_sock_ready_cb 2026-03-19 14:44:04 -04:00
leds.c
leds.h
lib.c
mgmt.c Bluetooth: MGMT: validate mesh send advertising payload length 2026-04-01 16:47:19 -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
mgmt_util.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mgmt_util.h Bluetooth: MGMT: Fix possible UAFs 2025-09-22 10:30:00 -04:00
msft.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
msft.h
sco.c Bluetooth: SCO: fix race conditions in sco_sock_connect() 2026-04-01 16:43:53 -04:00
selftest.c
selftest.h
smp.c Bluetooth: SMP: derive legacy responder STK authentication from MITM state 2026-04-01 16:48:06 -04:00
smp.h