haukepetersen opened a new pull request #861: URL: https://github.com/apache/mynewt-nimble/pull/861
I also stumbled upon some more non-thread-safe lines in the `ble_l2cap_coc` code while debugging erratic node behavior in the context of #865. Mainly the operation of setting `tx->sdu = sdu_tx;` in `ble_l2cap_coc_send()`, called by any user thread, could theoretically be interrupted from the NimBLE host thread and be overwritten before `ble_l2cap_coc_send()` returns. This is now prevented by doing this assignment inside a locked host. To further prevent any context switch to interfere, I moved both calls to `ble_l2cap_event_coc_unstalled()` inside a locked host environment. With this it is guaranteed, that any changes to the sending state (possible by `ble_l2cap_coc_send()` or `ble_l2cap_coc_le_credits_update()`) are always complete before any interruption can occur. I have been successfully using this fix together with #865 for a little while now in my experiment runs. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
