Skip to content

Conversation

@cvinayak
Copy link
Contributor

@cvinayak cvinayak commented Apr 10, 2019

Fix the controller implementation to make start encryption
queueable if there is any control procedure in progress.

The context related to encryption procedure is not shared so
that it will be used as the ongoing procedure completes.

The fix here maintains the old functionality of serializing
the queued data and LL Encryption Request PDU, so that data
queued before start encryption is acknowledged.

Fixes #15012. (which was marked as fixed but still had an outstanding issue)

Signed-off-by: Vinayak Kariappa Chettimada vich@nordicsemi.no

@cvinayak
Copy link
Contributor Author

@joerchan @carlescufi Ran encryption related 37 conformance tests, no regression.

@cvinayak
Copy link
Contributor Author

@thoh-ot is unable to review this until after Easter holidays. Hence, could we find another reviewer?

Copy link
Contributor

@mped-oticon mped-oticon left a comment

Choose a reason for hiding this comment

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

This pertains to the pre-split controller, which only permits Oticon to do a shallow review.
Nevertheless, I have read through it and found no issues.

Copy link
Member

@Qbicz Qbicz left a comment

Choose a reason for hiding this comment

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

#15012 which was fixed in #15186 still works with this PR. Security can still be established after any number of reconnections. Tested with nRF52 Desktop firmware on pca10059 + pca20041.

CC @carlescufi

@cvinayak cvinayak force-pushed the github_enc_req_queued branch from 8f0f6f6 to 13d22a3 Compare April 11, 2019 11:03
@cvinayak
Copy link
Contributor Author

Thanks @mped-oticon and @Qbicz.

I have fixed commit message for misspelled 'not' -> 'now' and 'at' -> 'after'.

@carlescufi
Copy link
Member

@Qbicz thank you for testing.

@carlescufi carlescufi added this to the v1.14.0 milestone Apr 11, 2019
@carlescufi carlescufi added the bug The issue is a bug, or the PR is fixing a bug label Apr 11, 2019
@Qbicz
Copy link
Member

Qbicz commented Apr 11, 2019

@cvinayak Actually now I noticed after reconnecting the peripheral 4 times, I get an assertion on central. I can reproduce it every time (after rebooting central 4th reconnection from peripheral causes this error again).
The assertion occurs in bt_recv_prio for hdr->evt = 26.

[02021262] <err> bt_hci_core: F: bt_recv_prio, evt 14
[02022348] <inf> ble_state: Connected to c4:ac:5a:2a:d5:21 (random)
[02022353] <err> bt_hci_core: F: bt_recv_prio, evt 15
[02022419] <err> bt_hci_core: F: bt_recv_prio, evt 15
[02024077] <err> bt_hci_core: F: bt_recv_prio, evt 15
[02040435] <inf> ble_state: Security with c4:ac:5a:2a:d5:21 (random) level 2
[02040447] <err> bt_ctlr_hci: Tx Buffer Overflow
[02040448] <err> bt_hci_core: F: bt_recv_prio, evt 26
[02040449] <err> bt_hci_core: assert: 'bt_hci_evt_is_prio(hdr->evt)' failed
***** Kernel OOPS! *****
Current thread ID = 0x200022dc
Faulting instruction address = 0x1a30e
Fatal fault in thread 0x200022dc! Aborting.
[0ASSERTION FAIL [out_ctx->control_block->offset <= out_ctx->size] @ /home/fi/ncs/zephyr/subsys/logging/log_output.c:101
***** Kernel Panic! *****
Current thread ID = 0x20003d14
Faulting instruction address = 0x8b3c

This reverts commit 0cf82cd.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix the controller implementation to make start encryption
queueable if there is any control procedure in progress.

The context related to encryption procedure is now shared so
that it will be used after the ongoing procedure completes.

The fix here maintains the old functionality of serializing
the queued data and LL Encryption Request PDU, so that data
queued before start encryption is acknowledged.

Fixes zephyrproject-rtos#15012.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak force-pushed the github_enc_req_queued branch from 13d22a3 to 33d0097 Compare April 11, 2019 13:53
@cvinayak
Copy link
Contributor Author

With @Qbicz and @joerchan help found the bug, in the form of missing code to update data queue head and tail after the enc_req pdu was moved to end of control queue. PR commit updated.

@Qbicz
Copy link
Member

Qbicz commented Apr 11, 2019

@cvinayak tested with latest pushed changes. I did connect+encrypt+disconnect 15 times and cannot see any issue anymore. Thanks for help @carlescufi and @joerchan

@nashif nashif merged commit fff35bd into zephyrproject-rtos:master Apr 11, 2019
cvinayak added a commit to cvinayak/zephyr that referenced this pull request May 7, 2019
Fix the encryption setup queueing implementation to avoid
overlapping with local initiated Length Update Procedure.

Fixes zephyrproject-rtos#15733.
Relates to zephyrproject-rtos#15335, and zephyrproject-rtos#15186.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
backporting bot pushed a commit that referenced this pull request May 8, 2019
Fix the encryption setup queueing implementation to avoid
overlapping with local initiated Length Update Procedure.

Fixes #15733.
Relates to #15335, and #15186.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nashif pushed a commit that referenced this pull request May 8, 2019
Fix the encryption setup queueing implementation to avoid
overlapping with local initiated Length Update Procedure.

Fixes #15733.
Relates to #15335, and #15186.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
cvinayak added a commit to cvinayak/zephyr that referenced this pull request Jun 4, 2019
Port the fix for the controller implementation to make start
encryption queueable if there is any control procedure in
progress.

Refer to zephyrproject-rtos#15335.
Relates to zephyrproject-rtos#15335, zephyrproject-rtos#15186, zephyrproject-rtos#15958 and zephyrproject-rtos#14636.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
carlescufi pushed a commit that referenced this pull request Jun 6, 2019
Port the fix for the controller implementation to make start
encryption queueable if there is any control procedure in
progress.

Refer to #15335.
Relates to #15335, #15186, #15958 and #14636.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nashif pushed a commit that referenced this pull request Jun 11, 2019
Fix the encryption setup queueing implementation to avoid
overlapping with local initiated Length Update Procedure.

Fixes #15733.
Relates to #15335, and #15186.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak deleted the github_enc_req_queued branch March 1, 2021 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to establish security after reconnect to dongle

7 participants