Commit graph zephyr/subsys/bluetooth
Author SHA1 Message Date
Emil Gydesen
9cd9a897c7 Bluetooth: BAP: SD: Shell: Fix conn_cb issue
There is a test case for the shell to build with
CONFIG_BT_CONN_DYNAMIC_CALLBACKS=n. Registering the conn
callbacks dynamically in the cmd_bap_scan_delegator_init
fails that test.

Change to use BT_CONN_CB_DEFINE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-24 11:42:53 +02:00
Emil Gydesen
9ebec0ef0d Bluetooth: BAP: SD: Add missing bt_conn_drop
If using past, we may take a reference to the ACL, but that
reference was never returned.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-23 17:38:40 -04:00
Emil Gydesen
18d9cd7a16 Bluetooth: BAP: Shell: Change codec_cap max frame size to 155
155 is the largest size defined by BAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-23 17:38:22 -04:00
Lyle Zhu
704998b85d bluetooth: classic: obex: Prevent requests after final bit is set
Add validation to prevent sending additional OBEX requests if the
SRM has been enabled after the final bit has been set in PUT or GET
operations on the Client side.

When the SRM has been enabled Without the waiting flag, if the final
bit of the request has been set in the last packet in a multi-packet
operation, the following request packet should not be set.

This ensures proper OBEX protocol sequencing by preventing clients
from sending additional requests if the SRM has been enabled once
they have indicated the final request in a multi-packet operation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
23955bb5df bluetooth: classic: obex: Add SRM and SRMP checking for Server
Check Single Response Mode (SRM) and SRM Parameters (SRMP) for
OBEX PUT and GET operations on the Server side to avoid the responses
that violate the GOEP specification.

Changes include:
- Add BT_OBEX_REQ_RECV and BT_OBEX_REQ_F_BIT flag definitions for
  tracking request reception and final bit state
- Implement obex_server_parse_srm() for parsing and validating SRM
  headers in both requests and responses
- Add obex_server_parse_req_srm() and obex_server_parse_rsp_srm()
  to handle SRM headers with first request tracking
- Implement obex_server_parse_srmp() for parsing and validating SRMP
  headers with proper sequencing checks
- Add obex_server_rsp_check() to validate response sequencing when
  SRM is enabled, ensuring responses are only sent when required
- Update obex_server_put_common() and obex_server_get_common() to
  parse SRM/SRMP headers and track request state
- Enhance bt_obex_put_rsp() and bt_obex_get_rsp() to validate
  response conditions, parse SRM/SRMP headers, and handle state
  rollback on failure
- Move opcode validation before buffer allocation to prevent
  resource leaks
- Improve error handling with proper flag restoration on failure

This implementation ensures the server properly validates SRM/SRMP
headers and enforces protocol rules for when responses must be sent,
complementing the existing client-side SRM/SRMP support.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
5da550f853 bluetooth: classic: obex: Add SRM and SRMP checking for Client
Check Single Response Mode (SRM) and SRM Parameters (SRMP) for
OBEX PUT and GET operations on the Client side to avoid the requests
that violate the GOEP specification.

Changes include:
- Parse and validate SRM/SRMP headers in client requests and responses
- Track SRM/SRMP state using client flags (BT_OBEX_REQ_1ST,
  BT_OBEX_REQ_SRM, BT_OBEX_REQ_SRMP, BT_OBEX_RSP_SRM, BT_OBEX_RSP_SRMP,
  BT_OBEX_RSP_RECV)
- Add request validation to ensure proper sequencing when SRM is
  enabled or disabled
- Refactor client request completion handling into
  obex_client_req_complete(), add obex_client_save_last_operation(),
  and obex_client_clear_active_state() helper
- Add obex_client_req_check() to validate request state before sending
- Restore client state on error in PUT and GET operations
- Move bt_obex flags enum from header to implementation file

SRM allows multiple requests to be sent without waiting for responses,
while SRMP provides flow control when the receiver needs the sender to
wait. This implementation ensures proper validation of SRM/SRMP headers
and enforces protocol rules for when responses must be received.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Lyle Zhu
58c670adfa bluetooth: classic: obex: fix inconsistent data types of if statement
Standardize pointer and error code comparisons throughout the OBEX
implementation to follow Zephyr coding guidelines:

- Replace implicit pointer checks (!ptr) with explicit NULL
  comparisons (ptr == NULL)
- Replace implicit error checks (!err) with explicit zero
  comparisons (err != 0 or err == 0)
- Update length checks to use explicit comparisons (len > 0
  instead of len, len == 0 instead of !len)

This improves code readability and consistency across the obex.c file
with the project's coding standards without changing any functional
behavior.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-23 17:36:34 -04:00
Rishav Chakraborty
64fdf2bb93 Bluetooth: audio: check bt_conn_ref return value in LE Audio APIs
bt_conn_ref can return NULL if the application passes a stale conn
pointer. Check the return value in all public LE Audio discover APIs
and return -ENOTCONN on failure.

Signed-off-by: Rishav Chakraborty <reshav01@gmail.com>
2026-06-22 15:48:19 +02:00
Aleksandr Khromykh
c5cee2130c bluetooth: mesh: shell: fix BLOB transfer progress calculation
The get_progress() function in the BLOB shell had two bugs:

1. The loop iterated over byte count (DIV_ROUND_UP(total_blocks, 8))
   instead of total block count, and the bit indexing used i % 8
   for both the byte index and bit position, meaning it only ever
   inspected the first byte of the missing_blocks array.

2. The final calculation (total_blocks - blocks_not_rxed) / total_blocks
   performed integer division without scaling, always yielding 0 or 1
   instead of a percentage.

Fix the loop to iterate over all block bits using proper byte/bit
indexing, and multiply the numerator by 100 to produce a correct
0-100 percentage result.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-22 14:30:48 +02:00
Yago Fontoura do Rosario
779a3b3bd2 bluetooth: host: Add function to resolve Bluetooth LE addresses
* Adds a public host API to resolve LE addresses into identity addresses

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2026-06-19 22:48:04 +02:00
Torsten Rasmussen
b425d7a375 kconfig: cleanup ZEPHYR_BASE usage
Remove `$(ZEPHYR_BASE)` from `source "<file>"`.
Source is always relative to ZEPHYR_BASE, so no need to specify it.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2026-06-19 22:40:14 +02:00
Aleksandr Khromykh
407ba2cc63 bluetooth: mesh: delayable_msg: fix chunk allocation
Use buf->len (actual data length) instead of buf->size (buffer
capacity) when calculating the number of chunks to allocate in
bt_mesh_delayable_msg_manage(). Using buf->size causes over-allocation
when the buffer capacity is much larger than the payload, starving
the chunk pool for other delayable messages.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-19 14:55:18 +02:00
Johan Hedberg
8cdc2c8c4c Bluetooth: host: enable the long workqueue for BT_ECC via a default
BT_LONG_WQ was enabled for BT_GATT_CACHING through a "default y if" on the
option itself, but for BT_ECC through an "imply BT_LONG_WQ" on BT_ECC.
Use a consistent mechanism for both by replacing the implication with a
"default y if BT_ECC" on BT_LONG_WQ.

Besides being more consistent, this makes the BT_ECC driven enablement
overridable through a configdefault: an "imply" sets a weak reverse
dependency that a (config)default cannot turn off, whereas a plain default
can. This allows platforms to disable the long workqueue (and fall back to
running the long-running operations on the system workqueue) via a
configdefault in their Kconfig.defconfig, which a subsequent change makes
use of on nRF51.

This change has no functional effect on its own: BT_ECC continues to enable
BT_LONG_WQ by default.

Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-18 14:39:50 -04:00
Anas Nashif
8104af619e typos: fix various typos under subsys/
Fix various typos.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-06-17 10:12:27 -04:00
Yago Fontoura do Rosario
11ad9d814b bluetooth: host: Update address handling in per adv sync established event
* Resolve both addresses before comparison to prevent comparing RPA with
Identity

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2026-06-17 10:09:26 -04:00
Aleksandr Khromykh
3564414a3b bluetooth: mesh: fix friend clear confirm delivery to lpn
When the LPN terminates a friendship by sending Friend Clear, the
Confirm was never received due to two issues:

1. The Friend's immediate Confirm was enqueued into the Friend
   Queue and then purged by friend_clear(). Fixed by calling
   friend_clear() before sending.

2. The Confirm advertisement completed before the LPN finished
   its own retransmissions and started scanning. Fixed by delaying
   the Confirm send based on network transmit parameters.

Additionally, bypass the LPN transport filter during the CLEAR
state so the Confirm is not dropped on arrival.

The clear procedure and Confirm contexts share a union since they
are mutually exclusive for the same Friend slot.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-06-17 10:05:19 -04:00
Emil Gydesen
65a95c5f12 Bluetooth: Host: Add additional info to asserts in bt_conn_index
Add the pointer as well as the address of the array.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-17 12:01:30 +02:00
Francesco Vatteroni
9d9363a1ff bluetooth: mesh: shell: dfd: report transfer progress in percent
The "dfd receivers-get" shell command prints the firmware distribution
progress under the JSON "progress" key, but first divides
bt_mesh_dfu_cli_progress() by two.

bt_mesh_dfu_cli_progress() is documented to return "the progress of the
current transfer in percent", i.e. a 0-100 value. The division mirrors
the on-wire encoding of the Transfer Progress field in the Firmware
Distribution Receivers List message, which is expressed in 2% increments
(0-50, see handle_receivers_get() in dfd_srv.c). That encoding is correct
for the over-the-air field, but applying it to a human-facing diagnostic
command is misleading: the command reports half of the actual percentage
(e.g. 25 while the transfer is at 50%).

It is also inconsistent with the Firmware Update Client shell command:
cmd_dfu_tx_progress() in shell/dfu.c prints bt_mesh_dfu_cli_progress()
directly as "DFU progress: %u %%", i.e. a 0-100 percentage.

Drop the division so the dfd shell reports the 0-100 percentage that the
API returns, aligning it with the dfu cli command. The on-wire encoding
in dfd_srv.c is intentionally left unchanged.

Signed-off-by: Francesco Vatteroni <francescov.90@gmail.com>
2026-06-17 08:05:02 +02:00
Emil Gydesen
ce7cde7261 Bluetooth: PACS: Fix typo when failing to register PACS
It should log "PACS" instead of "ASCS".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:50:45 +02:00
Emil Gydesen
5dd4e46c18 Bluetooth: BAP: USB: Add additional mixed chan wrn info
Add additional information if the audio data becomes mixed
so it's easier to debug.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:48:44 +02:00
Emil Gydesen
3f278a788e Bluetooth: BAP: Shell: USB use LOG_RATELIMT instead of bap_stats
Instead of logging based on the bap stats interval, the USB
part will not just use a flat rate limit of 30 seconds.
Since the bap_stats_interval and USB rates are used for 2 very different
things, and since USB will likely be trigger way more often, it did
not make a lot of sense to use the same value for both.

30 seconds was chosen as it still provides information to
the user on a reasonable interval, without filling up the
shell console too fast.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:48:05 +02:00
Emil Gydesen
85b6cba507 Bluetooth: BAP: SD: Add command to print receive state
Add command to loop through known receive states and print
their content. This also adds the request BIS sync value for
comparison to the currently synced value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:47:46 +02:00
Emil Gydesen
0f9c1c95f2 Bluetooth: BAP: BA: Shell: Change order of pa_interval and bis_sync
Change the order of the pa_interval and bis_sync arguments for
the add_src command. The reason is that the user will generally
care more about setting the right bis_sync value (e.g. to 0x01)
rather than the PA interval which may be set to "unknown" in
any case. With this change the user can set the bis_sync without
the pa_interval and just defer to the "unknown" PA interval value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:47:43 +02:00
Emil Gydesen
b9d82d19b4 Bluetooth: CCP: Add support for bearer technology
Add support for setting and getting the bearer technology
using the CCP API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-16 17:43:26 +02:00
Emil Gydesen
c962879dcf Bluetooth: BAP: Shell: Don't clear do_plc in the middle of SDU
The do_plc applies to the entire PLC, and not the individual frames,
so we should not clear it after doing PLC on the first frame.

Additionally this will now also do a memset after k_mem_slab_alloc
to avoid having to clearing data manually before free'ing it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-15 12:14:33 -04:00
Emil Gydesen
cb03ae6453 Bluetooth: BAP: Shell: Fix bug when updating USB streams
Since update_usb_streams rely on the sh_stream->rx to determine
whether to update the streams, we shall not clear that before calling
update_usb_streams

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-15 12:13:53 -04:00
Emil Gydesen
dbefc84380 Bluetooth: BAP: Shell: Print when codec_cfg was updated
Add calls to print_codec_cfg whenever the codec configuration
data or metadata may be changed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-15 12:13:42 -04:00
Emil Gydesen
f3e11cc51e Bluetooth: Audio: Shell: Rename CONTEXT and LOCATION with DEFAULT
Suffix the LOCATION and CONTEXT macros with DEFAULT to make it
clearer that these are just the default value, since both the
location and context are configurable at runtime.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-15 10:23:52 +02:00
Johan Hedberg
494283d469 Bluetooth: Host: GATT: Fix missing check for minimum read response size
There's a for loop in parse_read_std_char_desc() that'll go on forever if
rsp->len is 0. Add a minimum length check to the beginning of it to avoid
this issue.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-14 09:52:32 -07:00
Xudong Zheng
1b93c8b973 Bluetooth: Controller: Fix timer start without LLL prepare at margin
This workaround addresses an assert that appears when nRF52 hardware
running as central connects to a peripheral with certain connection
parameters.

Fixes #106450

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2026-06-14 15:32:51 +02:00
Emil Gydesen
0d3ac89a50 Bluetooth: BAP: Fix bad releasing state checks
The relasing state can go to IDLE or CODEC_CONFIGURED but
was defined to only allow IDLE or QOS_CONFIGURED.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 21:46:09 +02:00
Emil Gydesen
fb892aaa42 Bluetooth: BAP: SD: Fix log of wrong err value
The `err` variable was overwritten by the k_mutex functions
before being logged, so it did not log the actual error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 21:45:32 +02:00
Emil Gydesen
3877dead16 Bluetooth: BAP: UC: Add missing sys_cpu_to_le16 for SDU
Add missing sys_cpu_to_le16 when assigning SDU size to the QoS
configure operation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 15:46:51 +02:00
Emil Gydesen
5a90383263 Bluetooth: Audio: apply U suffix to unsigned integer literals
Apply the U suffix to unsigned integer literal constants used in
contexts involving unsigned types (uint8_t, uint16_t, uint32_t,
uint64_t, size_t, etc.) with coding guideline 40  which requires that
"A u or U suffix shall be applied to all integer constants that are
represented in an unsigned type".
In addition to this requirement, this commit also ads U to any unsigned
literal integer for the sake of completeness.

Changes are limited to literal values in assignments, initializations,
comparisons, and for-loop bounds where the context is unambiguously
unsigned.

Assisted-by: GitHub Copilot:claude-sonnet-4.6

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 15:46:35 +02:00
Emil Gydesen
af3d342f65 Bluetooth: BAP: Shell: Make it easier to copy broadcast IDs
The broadcast ID is printed in the shell various places. Often the
shell user wants to copy this value and use it for future commands.

Remove any following commas, so that the user can easier click-to-mark
the value to copy it.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 15:34:28 +02:00
Emil Gydesen
ff26f33f35 Bluetooth: BAP: UC: Add check for stream->group for QoS notification
If the server wrongly sends us a QoS state notification before
the stream was ever added to a group, we should just ignore it
rather than hitting the assert or dereferencing the group
later.

Additionally, LOG_ERR should not be used when validating input
from a remote device.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-12 15:31:54 +02:00
Emil Gydesen
d0834666d1 Bluetooth: ASCS: Use is_valid_num_ases for is_valid_stop_len
Instead of just checking the lower limit, use
is_valid_num_ases to also test the upper limit.
This approach is used by all other control point operations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-10 13:13:48 +02:00
Lyle Zhu
98e4c16d45 bluetooth: host: classic: fix SDP attribute parsing recursion check
Add missing type check in sdp_attr_parse() before recursively parsing
data element sequences. When checking the type of the next data if it
is a sequence, it did not first check if the current type is a
sequence.

It could lead to incorrect recursive parsing when the current type is
not a sequence but the next byte was incorrectly identified as a
sequence.

Fix the issue by checking the current data type firstly.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-10 13:12:11 +02:00
Emil Gydesen
9f5639ea75 Bluetooth: BAP: UC: Fix poorly worded "NULL is NULL" log
Fix poorly worded log statement.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-10 10:53:53 +02:00
Johan Hedberg
fe36ed31e5 Bluetooth: Host: Fix use-after-unref in bt_hci_le_enh_conn_complete
bt_hci_le_enh_conn_complete() obtains a reference via
find_pending_connect() but drops it immediately after the
bt_conn_connected() callback, while the function still dereferences
conn->role afterwards in the central-role scanner restart block.

Using a pointer after its reference has been dropped is a
use-after-free in API contract terms, even if in practice the
connection survives because other references (the conn array's
intrinsic reference, L2CAP, etc.) keep the object alive at this
point.

Move the bt_conn_unref() call to the end of the function so the
locally held reference outlives all uses of conn.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
7367ca6b8b Bluetooth: AVRCP: Fix use-after-unref in cover art L2CAP connect
bt_avrcp_cover_art_ct_l2cap_connect() obtains a reference to the ACL
connection via bt_avrcp_ct_get_acl_conn() but then immediately drops
that reference before continuing to use the conn pointer for
bt_conn_index() and bt_bip_l2cap_connect(). Using a pointer after
its reference has been dropped is a use-after-free in API contract
terms, even if in practice the underlying connection survives because
other references (e.g. the L2CAP channel, the ACL link itself) keep
the object alive while AVRCP cover art is in use.

Move the bt_conn_unref() call to after the last use of conn on each
return path so that the locally held reference outlives all uses.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
30cca0398f Bluetooth: Mesh: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
572b76130d Bluetooth: Classic: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
6455871bcf Bluetooth: Host: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
4c30188d60 Bluetooth: Audio: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded or take-then-unref-then-NULL variants) with
bt_conn_drop(&conn) which performs both operations atomically in a
single step. The guard is unnecessary because bt_conn_drop() handles a
NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
9cda39e08c Bluetooth: Host: Add bt_conn_drop() API
Add a new bt_conn_drop() function that atomically drops a connection
reference and clears the source pointer in a single step. This mirrors
the recently added net_buf_drop() API and replaces the common pattern:

  bt_conn_unref(conn);
  conn = NULL;

The new API handles a NULL pointer internally, so any guard around it
is unnecessary.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
18b85f7d06 Bluetooth: ISO: Use bt_conn_take() for ACL reference transfer
Replace the manual two-step pointer transfer:

  struct bt_conn *acl = iso->iso.acl;
  if (acl != NULL) {
          iso->iso.acl = NULL;
          ...
  }

with bt_conn_take(), which atomically extracts the reference and clears
the original pointer in a single step.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Emil Gydesen
b832650ee6 Bluetooth: Controller: ISO: Set cig->{p,c}_latency for periph
Add calculations to set the cig->c_latency and cig->p_latency
so that the CIS established event contains valid values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-08 16:33:01 +02:00
Johan Hedberg
1de8e9c1c5 Bluetooth: Host: L2CAP: Reject reconfiguration of non-dynamic CID
There was a missing check in le_ecred_reconf_req() that the provided CIDs
are dynamic (only those can be reconfigured). Add proper handling in case
a non-dynamic CID is encountered in the PDU.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-08 13:54:36 +02:00
Lyle Zhu
d64f781887 Bluetooth: host: fix unaligned access in LE LTK request event
The HCI LE LTK Request event parameters for `rand` and `ediv` should be
byte arrays, not integer types, to match the HCI specification and avoid
unaligned structure member access.

- Change `rand` from uint64_t to uint8_t[8]
- Change `ediv` from uint16_t to uint8_t[2]
- Add local variables in le_ltk_request() to convert byte arrays to
  integer types before passing to bt_smp_request_ltk()

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-08 10:38:01 +01:00