Skip to content

lib: bluetooth: peer_manager: LESC DHkey computation request fixes - #857

Merged
eivindj-nordic merged 2 commits into
nrfconnect:mainfrom
anhmolt:pm-lesc-dhkey-calc-state-fixes
Sep 22, 2026
Merged

eivindj-nordic merged 2 commits into
nrfconnect:mainfrom
anhmolt:pm-lesc-dhkey-calc-state-fixes

Conversation

@anhmolt

@anhmolt anhmolt commented Sep 17, 2026

Copy link
Copy Markdown
Contributor
  • Treat invalid connection handle as success when replying with a dhkey to the SoftDevice. It signals that the peer disconnected and the DH key is no longer needed.
  • Synchronize access to the DHkey computation requested state to avoid some theoretical race conditions between nrf_ble_lesc_request_handler() called from main context and nrf_ble_lesc_on_ble_evt() called from interrupt context.

Treat invalid connection handle as success when replying with a dhkey
to the SoftDevice.

Error BLE_ERROR_INVALID_CONN_HANDLE is only returned from
sd_ble_gap_lesc_dhkey_reply() in the compute_and_give_dhkey() function
if the peer disconnected while computing the DH key. In this case, the
DH key is no longer of any value and nrf_ble_lesc_request_handler()
function have succeeded.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
Synchronize access to the DHkey computation requested state
to avoid some theoretical race conditions between
nrf_ble_lesc_request_handler() called from main context and
nrf_ble_lesc_on_ble_evt() called from interrupt context.

Signed-off-by: Andreas Moltumyr <andreas.moltumyr@nordicsemi.no>
@anhmolt
anhmolt requested a review from a team as a code owner September 17, 2026 13:43
@github-actions github-actions Bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 17, 2026
@github-actions

Copy link
Copy Markdown

You can find the documentation preview for this PR here.

@PizzaAllTheWay PizzaAllTheWay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eivindj-nordic eivindj-nordic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog?

@anhmolt

anhmolt commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Changelog?

let us skip that here. Most changes are internal. The first commit (1a30bc2) touches the API of nrf_ble_lesc_request_handler() but the change should not be visible.

@anhmolt anhmolt removed the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Sep 21, 2026
@eivindj-nordic
eivindj-nordic merged commit 220b744 into nrfconnect:main Sep 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants